Drupal: how can I remove the links from taxonomy t

2019-02-25 01:45发布

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

3条回答
Explosion°爆炸
2楼-- · 2019-02-25 01:53

try this:

jQuery(".views-field-field-categories >.field-content >a").removeAttr("href");
查看更多
放荡不羁爱自由
3楼-- · 2019-02-25 01:56

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.

查看更多
Luminary・发光体
4楼-- · 2019-02-25 02:01

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.

查看更多
登录 后发表回答