WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
[resolved] Error 404 when clicking "2" (4 posts)

  1. MrCastor
    Member
    Posted 10 months ago #

    Hi there !

    I'm using Wp-pagenavi on a custom loop which display two categories.
    My code works well but when i click on next page = page not found...

    here's my code :

    ?php if(is_category('1')) { ?>
    
        <?php
        $paged = intval (get_query_var('paged'));
        if ($paged == 0) {
            $paged = 1;
        }
        $my_query = new WP_Query( array(
            'cat' => '1',
            'paged' => $paged,
            'posts_per_page' => '5'
            ) );
        while ( $my_query->have_posts() ) : $my_query->the_post();
        ?>
            <?php if (in_category('9')) continue; ?>
                <div class="actualites">
                    <h1><?php the_title(); ?></h1>
                    <h2><?php the_date(); ?></h2>
                    <p><?php the_excerpt(); ?></p>
                    <a href="<?php the_permalink() ?>" rel="bookmark"><ul><li>Lire la suite</li></ul></a>
                </div>
        <?php endwhile; ?>
            <div id="nav-below" class="navigation">
                <?php wp_pagenavi( array( 'query' => $my_query ) ); ?>
            </div><!-- #nav-below -->
    
    <?php wp_reset_query();
    ;}
    ?>
    
    <?php if(is_category('9')) { ?>
    
        <?php
        $paged = intval (get_query_var('paged'));
        if ($paged == 0) {
            $paged = 1;
        }
        $my_query = new WP_Query( array(
            'cat' => '9',
            'paged' => $paged,
            'posts_per_page' => '5'
            ) );
        while ( $my_query->have_posts() ) : $my_query->the_post();
        ?>
            <?php if (in_category('1')) continue; ?>
                <div class="actualites">
                    <h1><?php the_title(); ?></h1>
                    <h2><?php the_date(); ?></h2>
                    <p><?php the_excerpt(); ?></p>
                    <a href="<?php the_permalink() ?>" rel="bookmark"><ul><li>Lire la suite</li></ul></a>
                </div>
        <?php endwhile; ?>
    
            <div id="nav-below" class="navigation">
                <?php wp_pagenavi( array( 'query' => $my_query ) ); ?>
            </div><!-- #nav-below -->
    
    <?php wp_reset_query();
    
    ;} ?>

    Can't find the way to make it works :(

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

  2. MrCastor
    Member
    Posted 10 months ago #

    I found it !!!!!
    My "Blog pages show at most" parameter was not set right !

  3. jdev
    Member
    Posted 10 months ago #

    Im having the same issue. I have set my post per page in reading settings at 50 then 12 at my wp_query... what am I missing here?

    WP_Query( array( 'post_type' => 'translations', 'category_name' => single_cat_title('', false), 'paged' => get_query_var('page') ) );
    wp_pagenavi( array( 'query' => $loop ) );

  4. MrCastor
    Member
    Posted 10 months ago #

    Did you try to set your reading settings to 12 ?

Reply

You must log in to post.

About this Plugin

About this Topic

Tags