• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Help please: Displaying comments on blog page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Help please: Displaying comments on blog page

This topic is: not resolved

Tagged: displaying comments on main blog page, php

  • This topic has 9 replies, 3 voices, and was last updated 11 years, 10 months ago by Trisha.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • June 26, 2013 at 11:03 am #47809
    Trisha
    Member

    Hi everyone,

    I would like to display the blog post comments directly on the main blog page (e.g. the one which has multiple posts on it without a user having to click through to an individual post).

    Specifically, I want the comments to display on the guestbook main-page without people having to click through to a particular post.

    I have managed to get the comment form to display on each post using this code in my child theme's functions.php file:

    <?php
    add_action('genesis_setup','child_theme_setup',15);
    function child_theme_setup() {
    //extract from function child_theme_setup

    //Show comment form on posts without having to click through
    add_filter ('genesis_after_post_content', 'be_show_comment_form');
    }
    ?>

    <?php function be_show_comment_form() {
    global $withcomments;
    $withcomments = 1;
    comments_template();
    }
    ?>

    The comments template call is only rendering the form. (Note: I only have this change running on my localhost environment not on the live site). Anyone know what I need to add to display the actual comments with each post?

    Thanks,


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    http://www.philipenchanelle.co.za/guestbook-gasteboek/
    June 26, 2013 at 6:57 pm #47912
    AnitaC
    Keymaster

    Read this and see if it helps - http://wordpress.org/support/topic/show-comments-on-homepage-posts-without-showing-comment-form.


    Need help with customization or troubleshooting? Reach out to me.

    June 27, 2013 at 4:01 am #47986
    Trisha
    Member

    Thanks Anita,

    I definitely think that post put me in the right direction (since it led me to viewing the code for single.php).

    The solution to get the comments to display is a ridiculously simple line of code (which took me over 10 hours worth of playing around before I eventually stopped being prideful and asked for help).

    <?php function be_show_comments() {
    	global $withcomments; 
    	$withcomments = 1;
    	comments_template( ' ', true );
    }
    ?>

    I simply needed to add the arguments to the call to comments_template.

    Note: for the purposes of this site I do want to keep the comment form.


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    June 27, 2013 at 5:55 am #47993
    AnitaC
    Keymaster

    Well, don't wait so long next time! We are here to help you. I hope it works for you.


    Need help with customization or troubleshooting? Reach out to me.

    June 27, 2013 at 5:58 am #47994
    AnitaC
    Keymaster

    I think this might help you. You need a conditional statement that tells the code to NOT show up on the home page - http://wpspeak.com/remove-comments-section-genesis-framework/.


    Need help with customization or troubleshooting? Reach out to me.

    June 27, 2013 at 6:33 am #48004
    Trisha
    Member

    I won't wait next time 🙂

    With the way that the site has been configured (the home-page is a separate page that does not allow comments) so that it does not seem to be necessary, why do you think I need that?

    (Bearing in mind the blog home page is the guest book) ~ I ask to learn, not to argue.


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    June 27, 2013 at 6:55 am #48007
    AnitaC
    Keymaster

    So in your Genesis > Theme Settings - do you have the box checked for Comments on Pages or unchecked? Also on that individual page - is the Comment for Pages uncheck?


    Need help with customization or troubleshooting? Reach out to me.

    June 27, 2013 at 12:38 pm #48081
    Trisha
    Member

    Genesis > Theme Settings – Comments on Pages unchecked &
    Individual pages > Comments unchecked.

    Comments are only allowed on the blog page which is the guestbook.


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

    July 1, 2013 at 9:48 am #48687
    WatersWard
    Member

    I think this solution applies to me, but I can't figure out how to get it working. I have my blog set as the home page. I am only pulling 1 post and I want to display comments for that post. Will the function that Trisha posted above work? Where do I put that function?

    Thanks,

    Doug Ward

    July 1, 2013 at 11:22 am #48704
    Trisha
    Member

    Hi Doug,

    It should work for you.

    You need to include it in your functions.php file.

    Firstly you will need a function in your functions file to initialize subsequent functions. In this case my function looked like this:

    <?php
    add_action(‘genesis_setup’,'child_theme_setup’,15);
    function child_theme_setup() {
    //extract from function child_theme_setup
    
    //Show comment form on posts without having to click through
    add_filter (‘genesis_after_post_content’, ‘be_show_comment_form’);
    }
    ?>

    Secondly, you need to create your be_show_comment_form function, which is the one that looks like:

    <?php function be_show_comments() {
    	global $withcomments; 
    	$withcomments = 1;
    	comments_template( ' ', true );
    }
    ?>

    I hope this helps, Doug post the URL when you are looking for some help - it may make easier for us to help you.

    Kind regards,


    I tweet as @trishawebs

    “Make New Mistakes. Make glorious, amazing mistakes. Make mistakes nobody’s ever made before.” ~ Neil Gaiman

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble