WordPress.org

Support

Support » Plugins and Hacks » Hacks » Custom Taxonomy Pagination

Custom Taxonomy Pagination

  • 
    <?php
    $args = array( 'post_type' => 'news_events',
    'posts_per_page' => 4);
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    ?>
    
    

    and

    
    <ul class="news-events-pagination">
    <li class="older"><?php next_posts_link('Older')?>
    <li class="newer"><?php previous_posts_link('Newer')?>
    
    
    

    This is only i have,
    How to set a pagination on this taxonomy ?.
    -Thankyou-

Viewing 6 replies - 1 through 6 (of 6 total)
  • Add this code above your array
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    and insert this in your array 'paged' => $paged

    More information at https://codex.wordpress.org/Pagination

    Thank you bagwis,
    iam trying…

    Hi bagwis,
    code is working
    but my pagination link not active ?

    
    <ul class="news-events-pagination">
    <li class="older"><?php next_posts_link('Older')?>
    <li class="newer"><?php previous_posts_link('Newer')?>
    
    
    

    What do you mean?

    Hi bagwis,
    i insert the code as you said

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    and insert this in your array ‘paged’ => $paged

    now what else i have to do to get pagination number or newer older link to get it ?.

    You must have it by default since I assume you copied your theme’s archive and name it as archive-customtype.php. Unless you didn’t then you can copy the navigation code from your theme’s archive. Good luck

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Taxonomy Pagination’ is closed to new replies.
Skip to toolbar