Drupal: how can I remove the links from taxonomy terms?

主宰稳场 提交于 2019-12-20 02:38:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!