Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Comment Count on Linked Blog Posts
Avatar
JohnD
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 8:55 am

I've recently added the linked blog post option to my site and am noticing one issue with the installation and am unsure of how to fix it. 

Both comments left on the blog post and replies left within the forum will pass to their respective places - That is to say that a comment left on the blog shows up in the forum and vice versa. However, only comments left on the blog post add to the comment count of the post. 

You can see this on my test post on my site here which has 4 comments two created on the post and 2 created using the forum. Wordpress only sees the two that were created using the comment box under the post while the other two are displayed but not counted as comments.

http://www.phogropathy.com/wha.....hy-anyway/

However the same post on the forum has all four comments and they are counted properly. 

http://www.phogropathy.com/for.....hy-anyway/

So long story short, is there a way to display the comments as they are displayed within this post on my site, but have wordpress count the total of both WP comments and Forum comments in the comment count on the blog post?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 9:47 am

have you replaced the wp comment count template tag with ours?  that would be:  spCommentsNumberTag()

WP recently just updated their comments count to add a new filter to it... so it will now be possible for us to adjust the count without using our template function...  we just need to find the time to update our plugin to use the new wp filter... soon hopefully...

Avatar
JohnD
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 10:02 am

Mr Papa said
have you replaced the wp comment count template tag with ours?  that would be:  spCommentsNumberTag()

WP recently just updated their comments count to add a new filter to it... so it will now be possible for us to adjust the count without using our template function...  we just need to find the time to update our plugin to use the new wp filter... soon hopefully...

I'm not exactly sure how to change this, it might not be possible with the theme I'm using (headway 3.0). Or maybe I'm looking in the wrong place?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 10:08 am

typically it would be in the comments.php file in your theme... do you have one of those?  if its a recent theme, look for

get_comments_number()

we can help change it up... 

Avatar
JohnD
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 10:41 am

Yeah, it seems that Headway doesn't have a comments.php file that I can access. Not really sure if there's a way I can do this using their theme so I might have to just wait for the update to the plugin.

I have opened a topic over on their support forum as well to see if they have any insight into how I'd go about changing this bit of code I'll follow up here if they have a solution incase anyone else ends up with the same issue.

Thanks for the speedy replies :)

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 10:57 am

not familiar with headaway - using it that is, have heard of it... ;)

and themes have many, many ways to output comments count...  could be single.php or other... and themes can do their own thing too...

maybe we can try something real quick...  in the spFunctions.php file of the theme you are using (in the template files dir), try adding this code into it at the bottom, but inside the closing }

add_filter('get_comments_number', 'my_comments_count', 10, 2);  
function my_comments_count($count, $postid) {
    $total = 0;
    $links = sp_blog_links_control('read', $postid);
    if ($links) sp_forum_api_support();
    if ($links && sp_get_auth('view_forum', $links->forum_id)) {
        $sfpostlinking = sp_get_option('sfpostlinking');

        # link found for this post
        $total = sp_get_posts_count_in_linked_topic($links->topic_id, $sfpostlinking['sfhideduplicate']) - 1;
    }
    $count = $count + $total;
    return $count;
}

and lets see if that does anything...

Avatar
JohnD
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 11:19 am

Thanks for the try, but adding this code doesn't seem to have any effect on what is counted as comments on the blog post. 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 11:23 am

okay, will have to dig deeper...  that was a try at using the new wp filter on the comment count and adding in our comment count...

headway may be doing it non standard..

lets make sure its getting called at least...  right after the function definition (before $total = 0), add

vshow('here');

and see if that shows up in the display...

Avatar
JohnD
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 11:27 am

I'm not sure if this is related, but I just noticed that the comments which are passed to the linked post from the forum don't show up as comments in my WP dashboard even though they are displayed within the post on the blog.

Avatar
JohnD
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 11:34 am

Mr Papa said
okay, will have to dig deeper...  that was a try at using the new wp filter on the comment count and adding in our comment count...

headway may be doing it non standard..

lets make sure its getting called at least...  right after the function definition (before $total = 0), add

vshow('here');

and see if that shows up in the display...

This again doesn't seem to do anything. Although I'm not sure what you mean by "shows up in the display". 

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625