Short posts = no comment?
-
When posts are very short – like several here – the post index page doesn’t include a link to the post page so there is no obvious way for people to leave a comment. If they click on the blog link in the sidebar, they will find the right page to post a comment – but presumably those sidebar links will scroll out of sight over time.
Am I missing something? TIA.
-
From here, it looks as though the answer would be to include a “Comment” link at the bottom of each post excerpt on the index page. But I’m usually wrong.
Hi chappie, mm don’t think it’s about the shortness, is about those post types which haven’t a title (the title isn’t displayed)..
I see…but surely if one such post was 10000 words long, there would be a link to it as it would overflow the excerpt length?
Meanwhile, it’s possible for people to post a comment (by clicking on the post link in the sidebar) – which no-one else will ever see once the sidebar link scrolls out of view. Indeed, during testing, someone did just that and it presents me with a problem.
So is the solution never to use those post types? (Not elegant imho.)
Or is there a way to add a Comment button or link to the excerpts of all such post types?
For those kind of posts type the whole content should be printed, with a “Continue reading >>” text for the tag more, do you use the tag more there? That will insure you a link to the post.. and to me it seems the best option, instead of a comment link .. which is possible anyway ??
I don’t think there’s a problem with posts longer than the excerpt length. But I do want to provide a View/Add Comments option (linking to the post’s own page) for posts which are complete within the excerpt.
I guess I could add something manually to the end of every short post or relevant post type – but the site owner won’t be able to do that when she’s on her own…
Well chappie I didn’t said it depended on the shortness, I said exactly exactly the opposite ??
I said that for those particular post types customizr shows the content and not the excerpt. Also if you use the tag more into those post contents you should see a link which points to the articles. That’s what I said ??Said so, lunch time, if you still want this “comment link” for those post types I will be back with the code later.. ??
So chappie this is the code to have that link you wanted in those post types:
add_filter('the_content', 'add_leave_a_comment'); function add_leave_a_comment($content){ $post_formats = array('quote', 'aside', 'status', 'link'); if ( ! in_array(get_post_format(), $post_formats ) ) return $content; $leave_comment_string = __('Leave a comment'); $leave_comment_link = sprintf('<p class="chappie-comments-link"><a href="%1$s#comments" title="%2$s %3$s">%4$s</a></p>', is_singular() ? '' : get_permalink(), __( 'Comment(s) on' , 'customizr' ), get_the_title(), $leave_comment_string ); return $content . $leave_comment_link; }
Then style that p ??
Hope this helps.
The post types you’re talking about are “asides”. They are meant to be just a quick few words.
Maybe you would be better using a link post format.
Mmm but that is to show links, then he should wrote links in the post contents. Am I wrong?
Anyway @chappie , sorry I forgot to exclude that link when you display the post (post page), this is better:add_filter('the_content', 'add_leave_a_comment'); function add_leave_a_comment($content){ if ( is_singular() ) return $content; $post_formats = array('quote', 'aside', 'status', 'link'); if ( ! in_array(get_post_format(), $post_formats ) ) return $content; $leave_comment_string = __('Leave a comment'); $leave_comment_link = sprintf('<p class="chappie-comments-link"><a href="%1$s#comments" title="%2$s %3$s">%4$s</a></p>', get_permalink(), __( 'Comment(s) on' , 'customizr' ), get_the_title(), $leave_comment_string ); return $content . $leave_comment_link; }
Thanks chaps: I’ve been afk for a few hours but will play with this code now. It would be superdooperextragood? if it could include a little bubble with a number inside to show if there any comments to read…?
The post types you’re talking about are “asides”. They are meant to be just a quick few words.
I realise this ElectricFeet – but once a link shows in the sidebar then anyone is able to post a comment and they don’t know they aren’t supposed to! So I have to cater for that possibility, n’est-ce pas?
add_filter('the_content', 'add_leave_a_comment'); function add_leave_a_comment($content){ if ( is_single() || ! comments_open() ){ return $content; } $post_formats = array('quote', 'aside', 'status', 'link'); if ( ! in_array(get_post_format(), $post_formats ) ) return $content; /* mostly copied from class-content-hedings */ //adds filters for comment bubble style and icon $bubble_comment = ( get_comments_number() > 0 ) ? sprintf('<span class="fs1 icon-bubble"></span><span class="inner">%1$s</span>', get_comments_number() ) : ''; $bubble_comment = apply_filters( 'tc_bubble_comment', $bubble_comment ); $leave_comment_string = __('Leave a comment') . $bubble_comment; $leave_comment_link = sprintf('<span class="chappie-comments-link comments-link "><a href="%1$s#comments" title="%2$s %3$s">%4$s</a></span>', get_permalink(), __( 'Comment(s) on' , 'customizr' ), get_the_title(), $leave_comment_string ); return $content . $leave_comment_link; }
But you have to style it, you can style the whole span with this selector:
.chappie-comments-link.comments-link
and just the bubble (which is the default customizr comment bubble) with:
.chappie-comments-link.comments-link .fs1
=> the bubble
.chappie-comments-link.comments-link .inner
=> the number (which needs to be placed better, see top property)But you have to style it, you can style the whole span with this selector:
@d4z_c0nf – outstanding! Thank you. Your snippet is superb and imho repairs a little black hole in the platform logic. I will roll it out onto the live site shortly.
Brilliantly resolved!
Tested it?
Chappie don’t thank me, you know we always love you ??Tested on localhost – just playing with CSS now…
- The topic ‘Short posts = no comment?’ is closed to new replies.