1

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..

1

To 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!

  • Awesome! yeah thanks Chetan! I need to tweak it a bit for my theme, but I think I'm almost there! – user3547342 Jun 25 '19 at 6:42
  • yeah, you have to do just little bit changes according to your theme design. your welcome! – Chetan Vaghela Jun 25 '19 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.