• First, I am new to wp.

    I need a functionality that will return indicated instances of a term from the global count of that term.

    I am working on a paginated page and I tried using the terms count functionality. The functionality returns only the instances of terms from one paginated page only. This is not what I want.

    What should I edit to get the total count of a term?

    This is the code I am working on:

    <?php
    	$terms = get_terms("download_category");
    	$count = count($terms);
    	echo '<ul id="cr3ativeportfolio_portfolio-filter">';
    	   echo '<li class="cr3ativeportfolio_filter">Filter:</li><li><a href="#all" title="">' . __( 'All', 'aaaaaaaaaaaaaaaaa' ) . '</a></li>';
    	if ( $count > 0 ){
    
    	       foreach ( $terms as $term ) {
    
    	           $termname = strtolower($term->name);
    	           $termname = str_replace(' ', '-', $termname);
    	           echo '<li><a href="#'.$termname.'" title="" rel="'.$termname.'">'.$term->name.'</a></li>';
    	       }
    	}
    	echo '</ul>';
    ?>			  
    
    <?php
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        $args = array(
            'posts_per_page' => 9999999,
    	'showposts' => 12,
            'paged' => $paged,
            'post_type' => 'download'
        );
        $loop = new WP_Query($args);
    ?>
    
    	<?php if ( $loop ) :
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
     <?php
    	$terms = get_the_terms( $post->ID, 'download_category' );
    
    	if ( $terms && ! is_wp_error( $terms ) ) :
    	 $links = array();
    
    	 foreach ( $terms as $term )
    	{
    	    $links[] = $term->name;
    	}
    	 $links = str_replace(' ', '-', $links);
    	 $tax = join( " ", $links );
    	else :
    	 $tax = '';
    	endif;
    ?>

  • The topic ‘Term count does not return the total number of terms on a paginated page.’ is closed to new replies.