admin管理员组文章数量:1128994
I've googled this issue and can't seem to find a solution...
In the comments, I'm trying to remove the hyperlink from the comment date/time where when you hover over the comment date, it hyperlinks (example /#comment-210) to the following comment...
What can I put in functions.php to just remove the link, I want to keep the date/time text..
I've googled this issue and can't seem to find a solution...
In the comments, I'm trying to remove the hyperlink from the comment date/time where when you hover over the comment date, it hyperlinks (example /#comment-210) to the following comment...
What can I put in functions.php to just remove the link, I want to keep the date/time text..
Share Improve this question asked Jun 25, 2019 at 3:57 Liquid_Shane_OLiquid_Shane_O 391 silver badge7 bronze badges1 Answer
Reset to default 1To keep the date/time text, you have to do minor modification in comments.php just add call back argument in wp_list_comments function.
<?php
wp_list_comments( array(
'callback' => 'custom_format_comment_listing'
) );
?>
Then add Following code in your functions.php file. you can modification other html as per your design.
<?php
function custom_format_comment_listing($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author">
<?php echo get_avatar( $comment, 56 ); ?>
<?php printf(__('<div class="fn">%s</div> <span class="says">says:</span>'), get_comment_author()) ?>
</div>
<div class="comment-moderation">
<?php if ($comment->comment_approved == '0') : ?>
<p><?php _e('Your comment is awaiting moderation.') ?></p>
<?php endif; ?>
</div>
<div class="comment-meta commentmetadata">
<p ><?php printf(__('%1$s at %2$s'), get_comment_date('j F, Y'), get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></p>
</div>
<div class="user-comment">
<?php comment_text() ?>
</div>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
<?php }
?>
Let me know if this works for you!
本文标签: commentsphp keep comment datetime but remove datetime39s hyperlink
版权声明:本文标题:comments.php keep comment datetime but remove datetime's #hyperlink 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736728070a1949839.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论