Archived topic
Comment Box on Latest Posts Home Page
5 replies · Started by Alisha on September 9, 2016
I have a client who would like the comment box to appear below the blog posts on the home page (which is set for latest posts) instead of the "Leave a comment" link (that takes the person to the blog page).
I know this can be done by customizing the PHP but I prefer not to create a child theme for a number of reasons.
So, I tried creating a page that included a WP Show Posts shortcode for a listing of all blog posts and turning on comments for the page but there were two issues: 1) if there is more than one blog post, the comment page doesn't appear until after all of the blog posts are listed and 2) when a comment is added, it links to the page; not the blog post (if you have just one showing).
I also tried using <?php comment_form(); ?> in the 'After Content' GP Hooks which worked great but the comment box is duplicated when you go to the blog page.
Any suggestions?
Thank you! :)
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 :)
Thank you Tom - great suggestion. It fixed the duplication issue but it only adds a comment box to the first blog post on the home page (see demo site here: http://ripplerox.com/). Is there a way to add it to each blog post on the home page, regardless of the number or will he have to set his home page to just show one post?
ps Love the new picture - adorable!
This may be a limitation of the WordPress comment system - it's built to display only once on the single post page, so it may not be possible to include it under each and every blog excerpt on the main posts page.
Thank you! :)
Ah. Gotcha. Thanks for the help - as always. :)
No problem :)