Support » Plugin: WP-PageNavi » Not going to next page for custom posts. I really tried!

  • Resolved theUrbanCoin

    (@theurbancoin)



    Hi. I looked at dozens of other threads. And I really tried to implement all of the instructions from this post:
    https://wordpress.org/support/topic/navigation-not-working-3?replies=3

    Even though, I’m not a PHP expert, I figured I could follow all of the advice given. But I just can’t get things right. :/

    I have the Pagelines Framework. And I’m working with a custom post type called ‘boxes.’ I’ve pasted my full code below. The result: Pagination is showing up on the page and it recognizes the custom post type because the # of pages in pagination changes with ‘posts_per_page.’ But I can’t get it to control how many posts actually show or go to the next page when I click a page 2 or more.

    The ‘boxes’ post type has an option to control the maximum number of posts shown. I set it to 999 in hopes that Pagenavi would paginate this. But it isn’t doing it.

    Here’s my site: http://www.theurbancoin.com

    function pagelines_pagination() {
    
    if ( have_posts() ) {
        while ( have_posts() ) { ?>
            <?php the_post(); ?>
            <?php global $post; ?>
        <?php } // end while ?>
        <?php wp_pagenavi(); ?>
    <?php } // end if ?>
    
    <?php 
    
    $paged = get_query_var('page') ? get_query_var('page') : 1;
    $args = new WP_Query( array(
    	    'post_type' => 'boxes',
    	    'orderby' => 'date',
    	    'posts_per_page' => 10,
    	    'paged' => get_query_var('page') ) );
    
    	    //'paged' => $paged);
    
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    
        // Your Custom Loop Code Here
    
    endwhile; ?>
    
    <?php wp_pagenavi( array( 'query' => $loop ) ); 
    
    wp_reset_query();
    
    function pagelines_nav_fallback() {
    	global $post; ?>
    
    	<ul id="menu-nav" class="main-nav<?php echo pagelines_nav_classes();?>">
    		<?php wp_list_pages( 'title_li=&sort_column=menu_order&depth=3'); ?>
    	</ul><?php
    }

    PLEASE HELP ME REARRANGE MY CODE!!

    https://wordpress.org/plugins/wp-pagenavi/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not going to next page for custom posts. I really tried!’ is closed to new replies.