WordPress.org

Ready to get started?Download WordPress

Forums

Custom Taxonomy Pagination (7 posts)

  1. shihabmalayil
    Member
    Posted 1 year ago #

    
    <?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-

  2. bagwis
    Member
    Posted 1 year ago #

    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

  3. shihabmalayil
    Member
    Posted 1 year ago #

    Thank you bagwis,
    iam trying...

  4. shihabmalayil
    Member
    Posted 1 year ago #

    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')?>
    
    
    
  5. bagwis
    Member
    Posted 1 year ago #

    What do you mean?

  6. shihabmalayil
    Member
    Posted 1 year ago #

    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 ?.

  7. bagwis
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic