Basically, I want this:
The highest voted
answer 3 vote
The others
answer 1 vote
answer 2 vote
answer 1 vote
But I want to avoid this:
The highest voted
answer 3 vote
The others
answer 3 vote
answer 3 vote
answer 1 vote
Which doesn’t make sense since there are other answers voted 3 below.
So I would like to create an if else statement like this:
(run this only if there isn't posts with the same amount of votes)
The highest voted
answer 3 vote
(end if)
The others
answer 3 vote
answer 3 vote
answer 1 vote
So in this case that code (the highest rated answer) shouldn’t run.
I’m not sure if I should use php or jQuery for this.
The The_votes(); function is outputting something like this: +2 votes so I can’t use it directly since it has text.
I could make the comparisons based on divs or div classes.
Any suggestions about how to code this?
EDIT:
Example of PHP and HTML content of each answer:
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php bbp_reply_admin_links(); ?>
<h4><?php bbp_topic_reply_count(); ?></h4>
<div class="topic-like-count">
<?php if(function_exists('the_votes')) { the_votes(); } ?>
I guess I have to get only the number from the_votes and do something.
Why you can’t use
voting();?Even if returns text like
+xx votes;you can retrive the number with: