Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to display number of comments when comments are closed
Tagged: comments
- This topic has 8 replies, 4 voices, and was last updated 9 years, 1 month ago by justcurious.
-
AuthorPosts
-
October 21, 2013 at 9:55 pm #68130October 23, 2013 at 7:48 pm #68543nutsandboltsMember
You might try the Genesis Simple Comments plugin - I haven't used it, so I'm not 100% sure it will help, but I know it lets you customize the text that shows up when comments are closed: http://designsbynickthegeek.com/plugins/genesis-simple-comments
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+October 24, 2013 at 8:38 am #68620SummerMemberI was able to get this effect on one website by disabling comments in Settings > Discussions, but turning on comments in Genesis > Settings. No filters or plugins needed, after much trial and error.
The site was an archive site, where we didn't need new comments on any of the posts, but many of the existing posts had a few dozen comments each, and we wanted those to be displayed, at least in the single post view. The site is running Minimum v1, and Genesis 2.0.1, so it's still working as intended.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkOctober 24, 2013 at 1:13 pm #68674justcuriousMemberThank you both! I am a little worried about the plugin because it has not been updated in so long, and Summer, I can't disable comments in settings -- I do want new comments on most posts, but need to close them on some posts.
I have finally figured out how to do this for the Comment title at the bottom of single posts, so will eventually manage to get it working in the post meta.
January 4, 2014 at 7:09 am #83099outsidetheboxMember@justcurious
Care to share the solution? Because I'm just curious about the same thing too 🙂THanks!
January 4, 2014 at 8:55 am #83118justcuriousMemberOutsidethebox, I never totally solved it for the post entry meta...I show when comments are closed, but if comments are closed and there are already existing comments, the number of comments only appears below the post. Here is what I'm using for post entry meta:
add_filter( 'genesis_post_info', 'my_post_info_filter' ); function my_post_info_filter( $post_info ) { if ( ! comments_open() ) { $post_info = 'Posted by [post_author_posts_link] on [post_date] — Comments are closed [post_edit]';} else { $post_info = 'Posted by [post_author_posts_link] on [post_date] [post_comments zero="Leave a Comment" one="1 Comment" more="% Comments"] [post_edit]';} return $post_info; }
And here is what I use to show the number of comments at the bottom of the post:
add_action( 'genesis_before_comments', 'my_before_comments', 15); function my_before_comments() { if ( ! comments_open()) { return __(comments_number( '<h3>Comments are closed</h3>', '<h3>1 Comment — Comments are closed</h3>', '<h3>% Comments — Comments are closed</h3>' ), 'genesis' ); } else { return __(comments_number( '<h3>No Comments</h3>', '<h3>1 Comment</h3>', '<h3>% Comments</h3>' ), 'genesis' ); } }
Note that that is BEFORE genesis_title_comments, so you need to do something with that...either filter it out altogether, or what I did was filter genesis_title_comments to display a link to my comment policy.
If you come up with a better solution, hope you'll post it here!
January 4, 2014 at 11:24 am #83182outsidetheboxMember@justcurious
Thanks for responding! While I was waiting, I came pretty much to the same thing as you for the post info, but it's not a complete solution...And I've figured out the bottom part as well, albeit a little differently 🙂
I show the number of comments before they start. This looks logical for all posts.
// Modify comments header text in comments add_filter( 'genesis_title_comments', 'comments_title'); function comments_title() { return __(comments_number( '<h3>Start Discussion</h3> ', '<h3>Comments: 1</h3>', '<h3>Comments: %</h3>' ) , 'genesis' ); }
And then I show the notification after the last comment (where the comment form displays when comments are open). This explains the absence of the comment form.
//* Notify of closed comments add_action( 'genesis_after_comments', 'comments_closed' ); function comments_closed() { if ( is_single() && !comments_open() ) { ?> <div class="comments-closed"> <h4>Comments are closed</h4> </div> <?php } }
Perhaps you'll find this useful.
I'll keep digging, but my php skills come from google :)) I think we'll have to look past shortcodes, as they limit our options. I'm surprised this is not taken into account in the framework, pretty standard stuff.
February 23, 2015 at 3:25 pm #141920outsidetheboxMemberI'd like to revisit this thread with a solution provided by the support team. Turns out the solution has been in plain sight all the time, just hiding behind reverse implentation logic and poor documentation.
The [POST_COMMENTS] shortcode has a parameter currently documented as follows:
hide_if_off – Disable comment link even if comments is enabled.
The correct usage is hide_if_off="disabled", e.g.
[post_comments zero="No Comments" one="1 Comment" more="% Comments" hide_if_off="disabled"]
With the above code, the number of comments is displayed regardless of whether the comments are closed.
The thread is now resolved!
February 28, 2015 at 1:32 pm #142674justcuriousMemberWow, thanks, had long since given this up as not being worth the time to fix. But just implemented, works great and very useful to have.
Again, thank you, that was really nice of you to share!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.