admin管理员组文章数量:1289581
I would like to totally remove all the hyperlinks that my comments on wordpress are making. I've almost removed all the hyperlinks, but there is one left.
It is this one :
<span class="time"><a href="#comment-<?php comment_ID() ?>"></a></span>
Is there a way to add a custom php code in my functions.php file that would delete all this span class?
Thanks in advance!
I would like to totally remove all the hyperlinks that my comments on wordpress are making. I've almost removed all the hyperlinks, but there is one left.
It is this one :
<span class="time"><a href="#comment-<?php comment_ID() ?>"></a></span>
Is there a way to add a custom php code in my functions.php file that would delete all this span class?
Thanks in advance!
Share Improve this question edited Jul 14, 2021 at 15:20 Edouardo asked Jul 14, 2021 at 12:13 EdouardoEdouardo 11 bronze badge 6- How about using strip_tags on the final string? – Buttered_Toast Commented Jul 14, 2021 at 12:17
- @Buttered_Toast I've tried with a lot of codes including strip_tags that I've found on the internet for 4-5 days (I'm not a dev so usually I search for example of codes and I try to adapt it to my case) but it broke my site almost every time – Edouardo Commented Jul 14, 2021 at 12:35
- Are you hooking into a filter? where does this code come from? what code did you use to strip all the other tags? did you edit a .php file? it's hard to help without knowing from where this code comes from of what you already tried to do – Buttered_Toast Commented Jul 14, 2021 at 12:57
- Oh, yes, sorry! I'm not hooking it into a filter, I don't really know how to use them! This code comes from the comments.php file of my theme! The only thing that is working, is if I delete all this code from the comments.php file of my theme, but since my theme is updated almost every 3-4 days my modifications are removed every time. That's why I'm searching a code that I could put into my functions.php plugin that would remove this code from comments.php – Edouardo Commented Jul 14, 2021 at 13:05
- 1 Ohhh, thats exactly what child theme is for, if the theme was made with the option for child theme (most of them do), you can create a child theme with the comments.php file in it and do all the changes there. search for how to create a child theme, you will find alot of resources about this – Buttered_Toast Commented Jul 14, 2021 at 13:08
1 Answer
Reset to default 0You shouldn't be stripping this via the functions.php file but rather edit the comments.php to remove the span directly.
If this is a commercial theme that receives updates then you should do it by creating a child theme and customizing your functions.php & comments.php in that child theme.
This is a great tutorial on how to do that: https://www.smashingmagazine/2016/01/create-customize-wordpress-child-theme/
本文标签: commentsHow to remove a span class
版权声明:本文标题:comments - How to remove a span class? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741439187a2378813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论