[Resolved] Allow comments on home page

Home Forums Support Allow comments on home page

  • This topic has 6 replies, 2 voices, and was last updated 1 year ago by Leo.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1200883
    George

    Sorry if this is just too simple.

    I have GeneratePress set so the latest post appears on the home page.

    However, on the home page there is no comment box. Site visitors have to click the article header to go to the actual post where there is a comment box.

    Can I display the comment box on the home page too?

    Thanks!

    #1200886
    George

    p.s. I found the following response (from Tom) to a similar question. My question now is, where do I put the GP Hook code shown? Is it under Appearance > Elements > (and then what do I choose from the dropdown list; and what other steps should I take?). Thanks.

    You could set it to only happen on the front page in GP Hooks:

    <?php if ( is_front_page() ) {
    comment_form();
    } ?>

    That might be the best way to do it

    #1200905
    Leo
    Staff
    Customer Support

    Hi there,

    That depends on which hook you are trying to insert the comment form.

    You can see them here:
    https://docs.generatepress.com/article/hooks-visual-guide/#posts-page

    Maybe after_main_content hook?

    Just to make sure to check execute PHP.

    Let me know if this helps πŸ™‚

    #1200911
    George

    Many thanks, Leo. Will try it.

    #1200913
    Leo
    Staff
    Customer Support

    Let me know how it goes πŸ™‚

    #1200931
    George

    Ha-ha, it worked. Thanks again Leo. I chose after_main_content, as you suggested. Then it reminded me to set a location in the Display Rules tab. To review for others with this issue:

    1. In the WordPress Dashboard, choose: Appearance > GeneratePress > Elements > Add New
    2. Choose Element Type > Hook
    3. In the box, paste:
    <?php if ( is_front_page() ) {
    comment_form();
    } ?>
    4. In the Settings tab (below the box), choose after_main_content from the dropdown.
    5. Check Execute PHP.
    6. In the Display Rules tab, choose Location > Front Page.
    7. Click Update.

    #1200941
    Leo
    Staff
    Customer Support

    Glad you got it to work πŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.