Help please: Displaying comments on blog page

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

This topic is: not resolved

This topic contains 9 replies, has 3 voices, and was last updated by  Trisha 1 year, 3 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #47809

    Trisha
    Participant
    Post count: 19

    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/
    #47912

    AC
    Blocked
    Post count: 7712
    #47986

    Trisha
    Participant
    Post count: 19

    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

    #47993

    AC
    Blocked
    Post count: 7712

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

    #47994

    AC
    Blocked
    Post count: 7712

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

    #48004

    Trisha
    Participant
    Post count: 19

    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

    #48007

    AC
    Blocked
    Post count: 7712

    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?

    • This reply was modified 1 year, 3 months ago by  AC. Reason: correct typos
    • This reply was modified 1 year, 3 months ago by  AC. Reason: correct typos
    #48081

    Trisha
    Participant
    Post count: 19

    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

    #48687

    WatersWard
    Participant
    Post count: 2

    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

    #48704

    Trisha
    Participant
    Post count: 19

    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

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.