Add a Link to Post Comments in the Post List (Archive Page)

From iThemes Codex
Jump to: navigation, search

If you want to add a link to the post comments to your (archive) layout, add the following code at the end of your functions.php file (but before the closing ?>, if any).


function my_insert_comments_link() {
    return '<a href="' . get_comments_link() . '">Comments to this post</a>';
add_shortcode('insert-comments-link', 'my_insert_comments_link');


Insert the shortcode [insert-comments-link] in your LoopBuddy where you want the link to appear.

Customize the Appearance

In this example, the link will show as clickable text "Comments to this post". You can change this to any text, or an image.

Additional documentation

get_comment_link function reference from WordPress Codex

← Back to LoopBuddy Codex Home