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

From IThemes Codex
(Difference between revisions)
Jump to: navigation, search
(Created page with "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 <code>?></code>, ...")
 
 
Line 1: Line 1:
 +
__NOTOC__
 +
 
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 <code>?></code>, if any).
 
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 <code>?></code>, if any).
  

Latest revision as of 16:46, July 22, 2013


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

Code

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');

Usage

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

Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox