Site logo

Archived topic

Allow comments on home page

6 replies · Started by George on March 20, 2020

Viewing posts 1–7 of 7

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!

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

Many thanks, Leo. Will try it.

Let me know how it goes :)

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.

Glad you got it to work :)

This archived topic is closed to new replies.