The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Custom post type pagnation (1 post)

  1. svrdesign
    Posted 3 years ago #


    I have been trying to solve this for an hour or so, but unfortunately I am not a WordPress expert and would welcome some help.

    I am trying to get pagnation to work for a custom post type "accounting firms" on a page template with slug "page-accountants-logos.php".

    My code is as follows:

    <div id="content" class="site-content showcase" role="main">
    <?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
    elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
    else { $paged = 1; }
    $loop = new WP_query( array( 'post_type' => 'accountingfirms', 'posts_per_page' => 3, 'orderby'=> 'menu_order', 'paged'=>$paged ) );
    			while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div class="firm-logo">
    <a href="<?php the_permalink(); ?>" rel="bookmark">
    <img src=" <?php the_field('firm-logo'); ?>" />
    <h3> <?php the_title();  ?></h3></a>
    </div><!-- .firm-logo -->
    <?php endwhile; ?>
    <div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
    <div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
    </div><!-- #content -->

    3 posts show in the loop which is correct but no pagnation links are shown at the bottom?

    Any suggestions?

    Thanks for your help in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic