Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display correct counter


  • lucju04
    Participant

    @lucju04

    Hi everybody,

    I made a custom display of topics for a specific forum. Like this:

    <?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 10, 'post_parent' => '410' );
    					$loop = new WP_Query( $args );
    					while ( $loop->have_posts() ) : $loop->the_post(); ?>
    						<div class="bbp-forum-table__content--grid ">
    					
    							<div class="topic-title"><a href="<?php bbp_topic_permalink(); ?>"><?php the_title(); ?></a></div>
    					
    							<div class="replies-counter"><?php bbp_topic_voice_count(); ?></div>	
    					
    							<div class="posts-counter"><?php bbp_topic_post_count(); ?></div>
    						
    							<div class="user-freshness"></div>	
    						
    						</div>
    				<?php endwhile;?>

    But it’s seems that counter isn’t correct… Did I need to add something to count correctly the voice_count and post_count ?

    I already try the repair tools 🙁

    Thanks a lot 😉

Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    2 things occur

    1. this is the code in the template

    <li class="bbp-topic-voice-count"><?php bbp_topic_voice_count(); ?></li>
    
    	<li class="bbp-topic-reply-count"><?php bbp_show_lead_topic() ? bbp_topic_reply_count() : bbp_topic_post_count(); ?></li>

    2. these functions are looking for id so maybe

    <?php $post_id=get_the_ID() ; ?>
    <li class="bbp-topic-voice-count"><?php bbp_topic_voice_count($post_id); ?></li>
    
    	<li class="bbp-topic-reply-count"><?php bbp_show_lead_topic($post_id) ? bbp_topic_reply_count($post_id) : bbp_topic_post_count($post_id); ?></li>

    untested, but you get the idea

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar