Forum Replies Created
-
AuthorPosts
-
lmirabileMember
Wonderful - glad to hear it worked!
lmirabileMemberI haven't looked at the details of the education pro theme, but this code is for displaying any posted comments, plus a form to add a comment, after the main loop on the home page. It won't work on a post loop that's inside a widget, I'm afraid. You could probably alter the widget if you were determined to, but it might be easier to alter the home page template (aka front-page.php) to show the posts you want in the main loop rather than using the featured post widget. But, as I said, I don't know that particular theme...
lmirabileMemberSorry for the slow reply. But in case it's helpful to someone else:
The code you copied has the "key" code -- it's the
"global $withcomments;
$withcomments = 1;"
part.The code you copied should go into the functions.php file in your child theme's folder. You do not need to remove anything from comments.php to make it work (and doing so probably caused the problem you see).
lmirabileMemberThanks -- I did see that post, but it's only about the comment form, not the actual comments.
What did start me in the right direction was Trisha's comment in this post http://www.wpbeginner.com/wp-themes/how-to-show-comments-on-the-homepage-of-your-wordpress-theme/.
Setting global $withcomments = 1 is key.
However, I also found I had to alter genesis_get_comments_template, which deliberately excludes comments on the home page. I removed the action and added back a customized version allowing the front page too, like so:
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' ); add_action( 'genesis_after_entry', 'tt_get_comments_template' ); /** * Modified copy of genesis/lib/structure/comments.php genesis_get_comments_template() * Renders comments and comment form on front page, as well as singular post pages */ function tt_get_comments_template() { global $withcomments; $withcomments = 1; global $post; if ( ! post_type_supports( $post->post_type, 'comments' ) ) return; if ( is_singular() && ! in_array( $post->post_type, array( 'post', 'page' ) ) ) comments_template( '', true ); elseif ( ( is_singular( 'post' ) || is_front_page() ) && ( genesis_get_option( 'trackbacks_posts' ) || genesis_get_option( 'comments_posts' ) ) ) comments_template( '', true ); elseif ( is_singular( 'page' ) && ( genesis_get_option( 'trackbacks_pages' ) || genesis_get_option( 'comments_pages' ) ) ) comments_template( '', true ); }
-
AuthorPosts