How to fix #comments div links for comments plugins in StudioPress Genesis

If you are using a WordPress Comments Plugin like Livefyre or Disqus to handle the comment discussion on your site, your theme’s links to the #comments div may be broken once the default comments have been turned off. Today’s snack will show you how to fix the #comments div links for comments plugins used in a StudioPress Genesis theme to where your theme’s Comment links work throughout your site.

Add this code below to the functions.php file of your current WordPress theme.

/**
 * Fix #Comments Div Links for Comments Plugins in StudioPress Genesis
 *
 * @author WPSnacks.com
 * @link http://www.wpsnacks.com
 */
function fix_comments_links() {
?>
<div id="comments"></div>
<?php
}
add_action('genesis_after_post_content', 'fix_comments_links'); 

Now when a visitor clicks the Comments link for any of your posts, it will take them to the new comments area created by your WordPress Comments Plugin.

   Related Sponsored Links

Disclaimer: The information contained in this website is for general information purposes only and in no event will this site or its owners be liable for any losses or damages associated with your use of our site or content. Click here to see our full Disclaimer.

Comments

  1. hello can you guide me to adapt this fix to the shakengrid template for wp ? http://www.legrandecart.net/debattre-en-toute-serenite/#comments
     
    is not poiting to the livefyre comment divs, but it does link well to the post..any quick fix ?

  2. IliganLocal says:

    Thanks for the tip! I’m using Disqus and it worked on my site. Still having trouble tho having custom elements appear before the “genesis_before_comments” hook. Might you have a solution to my problem?
     
    Thanks

Leave a Comment

*