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
Blog Post Linking - getting my theme to acknowledge comments made via forum
Avatar
Jasneet Gulati
Member
Free Members
sp_UserOfflineSmall Offline
Jun 1, 2012 - 6:39 pm

Hi guys,

I've had a search and couldn't find the solution to this.

This is my first post, and I'd just like to say that I am really enjoying the ease of using Simple:Press and that it's a great forum. Thank you for your hard work.

I have used the blog linking to great success - it works!

The only thing that is not perfect is that only the comments I make on the front end of my blog get recorded such that it will display '5 comments' - even though there there may be a total of 15 comments to read (10 comments made on the forum).

How can I change this so that the comments counter acknowledges the posts made on the forum as a comment, too.

To rephrase if I am not making myself clear is that although the linking itself is working perfectly, the 'number of comments' is not accurate as it does not count the comments from the forum.

I realise that the solution needs to correct the counting of comments within the singlepost.php and also on the front end of my blog ie. 'recent posts' as they are all inaccurate.

I hope this makes sense, if not I will be happy to clarify.

I have no knowledge of php - so if you would like I could copy and paste any code from my theme at your request in order to diagnose and correct the issue.

Kindest regards.

JG

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jun 1, 2012 - 7:46 pm

may need Andy to weigh in here since he wrote the blog linking plugin, but lets give it a shot...

so you are successfully getting comments synced between the blog post and the forum topic?  just the count is not correct on the blog post?

can you look in the theme comments.php file (assuming it has one) and see how it is accessing the comments? if its relatively recent theme, its likely accessing it via

wp_list_comments()

with some arguments...  I would like to know what those arguments are...

Avatar
Jasneet Gulati
Member
Free Members
sp_UserOfflineSmall Offline
Jun 2, 2012 - 5:41 am

Hi Mr. Papa thank you kindly for your swift reply.

Mr Papa said 
so you are successfully getting comments synced between the blog post and the forum topic?  just the count is not correct on the blog post?

Yes you are absolutely correct.

Later today, when I get a chance, I will copy and paste the comments.php. From memory, I can confirm that it did have the 'wp_list_comments()'.

Thank you kindly, I will be back later today!

JG

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jun 2, 2012 - 5:57 am

Actually we can probably do a little better than this.

The most common WP function for displaying the number of comments is a function called comments_number().

Take a look through the comments php file to see if you can find this function being used. If it is - comment it out and replace it with the following:

spCommentsNumber("0 Comments", "1 Comment", "% Comments", true);

Replacing those labels with your preferred text of course.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Jasneet Gulati
Member
Free Members
sp_UserOfflineSmall Offline
Jun 2, 2012 - 11:04 am

YellowSwordfish,

That has worked perfectly, thank you.

This is the result:

It has workedImage Enlarger It now displays the correct number of comments at the bottom.

I also used your code to edit the following in single.php - and it too worked. The image below shows before I used your code.

I changed 'comments_popup_link('0','1','%');' in single.php to what you have suggested, and that has worked perfectly!

 However, I couldn't find an obvious place to insert your code for it to work with the recent posts widget (see pic). This is what it displays on my home page - showing 5 comments, not 11. Any ideas, sir?

I suspect I have to change something with the widget?

Thank you for your help!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jun 2, 2012 - 1:43 pm

That one is going to be much trickier and might depend on how it is wrotten.
What widget is this? Is this the stadard Wp supplied widget or a special one supplied with theme or another plugin?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Jasneet Gulati
Member
Free Members
sp_UserOfflineSmall Offline
Jun 2, 2012 - 2:39 pm

Thanks Yellow Swordfish.

This particular widget is one supplied by the Theme - the theme is called Avenue.

Would this work if I used a standard wordpress widget, you think?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jun 2, 2012 - 3:00 pm

As I say it depends on the code and I canlt vouch for either of them. Can you send me the widget code by any chance?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Jasneet Gulati
Member
Free Members
sp_UserOfflineSmall Offline
Jun 2, 2012 - 3:32 pm

I could send you the entire widget code at your request but there's quite a lot in there.

Searching for the term 'comment' this is what comes up:

<h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></problem-with-post-edit-button2>

<span class="block-meta"><?php the_time('F j, Y'); ?>, <?php comments_popup_link(); ?></span>

</div>

<?php endif; ?>

<?php $counter++; endwhile; ?>

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jun 2, 2012 - 4:41 pm

Well there is that comments_popup_link() function again that you changed last time so it might be worth trying it in this code as well perhaps? Never any harm in trying!

andy-signature.png
YELLOW
SWORDFISH
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: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625