问题
I like the taxonomy terms in my nodes pages, but I don't want user being able to click on them. I just want to remove the links.
I'm trying to remove them from taxonomy module php files, but I cannot find them.
Thanks
回答1:
You never want to edit a core module like taxonomy, as this makes it very complicated to upgrade your Drupal install. See also.
You can use hook_link_alter to alter/remove the links in your own module. Adding them back in as non-links is a little more complicated, but can be done in your node.tpl.php file with example code.
回答2:
I would suggest Display Suite module or some jQuery
jQuery(".taxonomy-term h2 a").each(function(){
var $t = jQuery(this);
$t.after($t.text());
$t.remove();
Thanks @Will and @Matt for this elegant solution.
回答3:
try this:
jQuery(".views-field-field-categories >.field-content >a").removeAttr("href");
来源:https://stackoverflow.com/questions/2943453/drupal-how-can-i-remove-the-links-from-taxonomy-terms