• Resolved Daniel

    (@dmzayasplus)


    I have the generic category code set up as:

    <?php
    $args = array ( 'category' => ID, 'posts_per_page' => 5);
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :	setup_postdata($post);
     ?>
    //Style Posts here
    <?php endforeach; ?>

    And the styled posts are very simple:

    <div class="col-md-6">
    			<a href="<?php the_permalink(); ?>"><img src="<?php echo uf(person_image); ?>" width="100%"></a>
    		</div>
    		<div class="col-md-6 text-right">
    			<h3 style="margin-top:0px;"><em><?php echo uf(project); ?></em> Designer<br /></h3>
    			<h1 style="margin:5px 0px;font-weight:bold;"><?php the_title(); ?></h1>
    			<p><?php echo the_date(); ?></p>
    			<p><a href="<?php the_permalink(); ?>" class="btn btn-primary btn-lg btn-block" role="button">READ THE FIVER >></a></p>
    		</div>
    		<div class="clearfix"></div>
    		<hr>

    But when I click to the nav links on the bottom, the next page shows exactly the same posts as the first.

    https://wordpress.org/plugins/ultimate-fields/

Viewing 1 replies (of 1 total)
  • Plugin Author Radoslav Georgiev

    (@radogeorgiev)

    Hi dmzayasplus,

    I can’t fully understand what you are doing.

    When I read the question and take a look at the first block of code, I get the feeling that you should use a standard query like `<?php
    $args = array ( ‘category’ => ID, ‘posts_per_page’ => 5);
    $the_query = new WP_Query( $args );
    while( $the_query->have_posts() ) {
    $the_query->the_post();

    //Style Posts here
    } ?>`

    and then use a snippet like

    <?php
    $big = 999999999; // need an unlikely integer
    
    echo paginate_links( array(
    	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    	'format' => '?paged=%#%',
    	'current' => max( 1, get_query_var('paged') ),
    	'total' => $the_query->max_num_pages
    ) );
    ?>

    This snippet uses the paginate_links function and is copied from http://codex.wordpress.org/Function_Reference/paginate_links .

    The thing is that I don’t really see a pagination-related code in your theme.

    If this doesn’t fix the issue, please either paste more of the code you are working on or try experimenting with the function i mentioned.

    BR,
    Rado

Viewing 1 replies (of 1 total)
  • The topic ‘Category Template not paginating.’ is closed to new replies.