Closed EmilyRyan closed 9 years ago
It appears to be working properly, what it does it go to the section of the single comic page for it and then moves the browser to the comments area
Just to clarify: for me, the number in the parenthesis does not show the number of comments for the current page, but a different one, so it becomes misleading. I thought it was a problem with my php-files but the same problem is exhibited here: http://comiceasel.com/comic/segway/#comments
This is a detail of course. Thank you for your hard work!
The link you provided shows 0 comments and has 0 comments ... on the comiceasel.com site
Yes, the Segway link has 0 comments, so it's not completely the same, I only provide it as an example of other things that seem odd: when I click the comment button my browser (Chrome or Firefox) window doesn't jump to a comments anchor. If you look at this link instead, a page of mine without comments, it lists comment number as 2: http://emilyryan.se/gramarye/comic/im-strong-willed-just-not-right-now/ (The link I provided in the very first post was the only page with comments, i.e the only single page that works)
I see it now. - on your site.
.. that can happen if there was something taking over the filter, or the $post->ID gets corrupted but it's not .. it also can happen if you have trackbacks but are not showing those trackbacks.
Can I get a screen capture of your (wp-admin)dashboard -> comments - section?
As for the links not working, it's because the old version of Responsive you're using doesn't have the #comments ID showing unless there are actually comments there
http://emilyryan.se/gramarye/comic/the-roster-of-names/#comments This one works because there's actually comments. It's a bug in the theme that's causing the other's not working
Is this the one you mean?
Yes, absolutely - Now we've narrowed it down to it not being trackbacks not-showing
So the next step is to check if you have any plugins that might be filtering the comments section - to do that, you basically disable and clear cache of all plugins except the comic easel plugin then you check the posts to see if it's still saying the (2) on it
I use Akismet and Slim Jetpack. Akismet and Jetpack deactivated and cache emptied show no change for me yet.
Okay go ahead and put them back on clearing cache again - and thank you for helping me debug.
I made some changes to this github in the way of the comments appearing, if it still continue's then the only thing i can think of is that the theme is filtering the comments code changing the $post->ID to something other then it should be
I have updated the injections.php, navigation.php and comiceasel.php on my server (the files I saw you had changed within the last hour). I don't see any change yet so I guess it's a problem with the theme. Thank you for your help!
Still an issue?
Yeah... no change. I don't know what to do. http://emilyryan.se/gramarye/comic/the-roster-of-names/#comments isn't perfect either, the comments in the next, previous navigation should show (2).
unless two of them are pingbacks and not displayed
No, I'm almost certain they aren't, or rather, it would be an incredible coincidence. Comments (4) is displayed on every page except the starting page. It is the total number of comments that I have on comic pages in total. Page with zero comments showing (4): http://emilyryan.se/gramarye/comic/trail-of-seals/ Page with two comments showing (4): http://emilyryan.se/gramarye/comic/the-sheep-rises/
Your theme has a filter on it.
/core/includes/functions-extras.php
line: 67 add_filter( 'get_comments_number', 'responsive_comment_count', 0 );
if you encapsulate that line with /* */ (or) two // slashes in front of it to comment it out from running, tell me if it still happens
The function it runs is written wrong:
function responsive_comment_count( $count ) {
if ( !is_admin() ) {
global $id;
$comments = get_comments( 'status=approve&post_id=' . $id );
$comments_by_type = separate_comments( $comments );
return count( $comments_by_type['comment'] );
} else {
return $count;
}
}
That should be global $post; and &post_id=' . $post->ID
Cause $id can't be guaranteed to have the right value inside of it with everything going on in a page, should not be used in this method
also (in addition to)
if (!is_admin() && in_the_loop()) {
would make it so it only runs on sections that are 'in the main loop'
I commented out line 67 and added && in_the_loop(). It works like a charm! Thank you for the help, I would never have found it myself! Looking through other people's themes is beyond what anyone would hope for, so thank you.
$post and $post->ID replacing $id one and in_the_loop() is the fix ..
the commenting out the line only tests if that was where the problem was ;)
sorry I didn't make myself clearer heh
This is what I did, everything seems to work:
function responsive_comment_count( $count ) {
if ( !is_admin() && in_the_loop()) {
global $post;
$comments = get_comments( 'status=approve&post_id=' . $post->ID );
$comments_by_type = separate_comments( $comments );
return count( $comments_by_type['comment'] );
} else {
return $count;
}
}
: )
yeah but if you comment out line 67 it won't even run that ;/ so try it without 67 commented out if it breaks it again, recomment
Forgot to say; I also removed the comment!
\o/ yay hehe
In the Comic Easel config there is an option that I left activated:
Enable the comment link in the comic navigation? When this is enabled, a link will appear in the navigation that lets you go to the comments section of the current post, it also shows how many comments there currently are.
Problem is, on each comic page of my site except the main page, the parenthesized number shows the total amount of comments I have received (2) on a different page, this one: http://emilyryan.se/gramarye/comic/the-roster-of-names/
Whether this is a bug or me setting up the URL:s wrong I can't say, but I thought I'd report it just in case.