Add myCRED Rank to Comments Section
-
Hey Guys!
First off, loving your plugin ?? Thanks for building it!!
I’m trying to add the myCRED rank title below the commenters name in the list of comments that appears at the bottom of each blog post. I found the following support article, but I’m pretty sure the exact implementation will depend on the theme that you’r using – unfortunately after a few different tries I haven’t been able to get it:
https://mycred.me/support/tutorials/adjust-comment-layout-according-to-rank/
Here’s the code I’m trying to edit (I believe I’m in the right spot):
<!-- display the comment --> <div class='comment_content'> <header class="comment-header"> <?php $author = '<cite class="comment_author_name"'.avia_markup_helper(array('context' => 'author_name','echo'=>false)).'>'.get_comment_author().'</cite>'; $link = get_comment_author_url(); if(!empty($link)) $author = '<a href="'.$link.'" '.avia_markup_helper(array('context' => 'comment_author_url','echo'=>false)).'>'.$author.'</a>'; printf(__('<cite class="author_name heading"'.avia_markup_helper(array('context' => 'comment_author','echo'=>false)).'>%s</cite> <span class="says">says:</span>'), $author) ?> <?php edit_comment_link(__('(Edit)','avia_framework'),' ','') ?> <!-- display the comment metadata like time and date--> <div class="comment-meta commentmetadata"> <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"> <time <?php avia_markup_helper(array('context' => 'comment_time'));?>> <?php printf(__('%1$s at %2$s','avia_framework'), get_comment_date(), get_comment_time()) ?> </time> </a> </div> </header>
From what I can tell on the support article I should be inserting the following code somewhere in the above code, but I’m not sure if I’m missing something or just inserting it in the wrong place.
// Insert rank title if ( $comment->user_id != 0 ) echo '<div class="fn authors-rank" style="margin-left:6.071428571rem;">Rank: ' . mycred_get_users_rank( $comment->user_id ) . '</div>';
I’d really appreciate any assistance you can provide.
Thanks!
- The topic ‘Add myCRED Rank to Comments Section’ is closed to new replies.