WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
wp-pagenavi throws error 404 (11 posts)

  1. vizen
    Member
    Posted 2 years ago #

    Hi Need Help!, WP-PageNavi throws error 404 once i click to the next page, for example im on Page 1 of 10, then when i click to Page 2 and so on, it directs to page 404.

    heres my code :

    <?php
    // The Query
    $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    $args = array('post_type' => 'presse', 'status' => 'publish', 'paged' => $paged, 'orderby' => 'date');
    $the_query = new WP_Query($args);
    // The Loop
    // wp_reset_query();
    if ($the_query->have_posts()):
    
    	while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
    		<div class="news-list-wrapper">
    			<div class="news-list group">
    				<h2 class="published"><?php the_time('d.m.Y'); ?></h2>
    				<a href="<?php the_permalink() ?>"><?php the_title('<h1>', '</h1>'); ?></a>
    				<?php the_excerpt(); ?>
    			</div>
    		</div>
    <?php endwhile; ?>
    <div class="pagination_btn">
    	<?php
    		wp_pagenavi(array('query' => $the_query));
    
    		wp_reset_postdata();
    
    	?>
    </div>
    <?php else: ?>
    	<div><p>No Content Available</p></div>
    <?php endif; ?>

    heres the link : http://connex-wordpress.bea8.de/aktuelles/news/

    Hope for you response,

    Thanks,

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. vlad_manuel
    Member
    Posted 2 years ago #

    Hi. Same problem here. Would appreciate very much your help.

  3. troya86
    Member
    Posted 2 years ago #

    I have the same problem, wp-pagenavi 2.82 , wp 3.3.2
    :(

  4. r1se
    Member
    Posted 2 years ago #

    Hi gus, did any of you manage to fix this? I'm having exactly the same problem.

    Heres my code:

    <?php 	
    
    					$the_query = new WP_Query(
    						 array(
    							'posts_per_page' => '3',
    							'paged' => get_query_var('paged'),
    							'category_name' => 'revista-matiz'
    						)
    					 );
    
    					if($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
    			?>
    
    			<div id="contenedor-matiz">
    				<h1 class="titulo-post"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
    				<?php the_post_thumbnail('revista-matiz-thumb'); ?>
    				<?php the_content('seguir leyendo'); ?>
    			</div><!-- /#contenedor-matiz -->
    
    			<?php endwhile; endif; ?>
    
    			<?php 
    
    				wp_pagenavi( array('query' => $the_query ));
    				wp_reset_postdata();
    
    			?>

    Just like troya86 i'm using latest wordpress and wp pagenavi. My permalinks structure is /%category%/%postname%/

    Let's find out what might be the problem!

  5. watermelonkid
    Member
    Posted 2 years ago #

    Exact same problem and permalink structure for me. Anyone solve?

  6. Jusi
    Member
    Posted 2 years ago #

    Same problem here, my code:

    <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>
    <?php $work_items = new WP_Query(array( 'post_type' => 'work', 'posts_per_page' => '12', 'paged' => $paged ) ); ?>
    <?php while ($work_items->have_posts() ) : $work_items->the_post(); ?>
    
    <div class="col2 work-item">
        <a href="<?php the_permalink(); ?>">
            <img src="<?php the_field('work_overview_thumbnail'); ?>" alt="" />
            <p class="descr"><?php the_field('work_overview_description'); ?> <span><?php the_field('work_client_name'); ?></span></p>
        </a>
    </div>
    
    <?php endwhile; ?>
    
    <?php wp_pagenavi(array( 'query' => $work_items )); ?>

    Using get_query_var('page') cause it's a custom page template as explained in this article. Using get_query_var('paged') doesn't work either.

    My permalink structure is just /%postname%/

    Has anyone managed to fix this problem?

  7. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    Folks, none of you have mentioned in which file you have placed that code.

  8. Jusi
    Member
    Posted 2 years ago #

    Hi Scribu, thanks for your reply!

    I use my code (above) in a custom page template (which is why I'm using get_query_var('page')). Think a portfolio page that I'm trying to display my Work CPT posts on.

    EDIT: I changed my code a bit with an exact copy/paste from your article I mentioned above:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    but that doesn't work either. I'm not sure I should be using get_query_var('page') or get_query_var('paged')

  9. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    Regardless if you use 'page' or 'paged', you should not get a 404.

    It works fine for me, WP 3.3.2, same permalink structure. So, check elsewhere (possibly other active plugins or other theme code).

  10. oobedoob
    Member
    Posted 2 years ago #

    I'm having the same problem after upgrading to 3.4 I get a 'Page not found' error whenever I click on a number or the 'Next' button. Yet on another site that I have that is also running 3.4 and the same plugin it works fine.

  11. cinematic
    Member
    Posted 2 years ago #

    This seems to happen in wordpress 3.4 if paginating custom post types.
    Check out this post
    http://wordpress.org/support/topic/wordpress-34-broke-my-paginaton-setup?replies=20#post-2891468
    It solved the problem for me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic