Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When I try to use next_posts_link() and previous_posts_link() in my archive posts page I got a 404 error page.

I'm using this permalink setting /%category%/%postname% and working well for all pages like site.com/contacts or posts like site.com/category/this-is-a-post-tile.

The only problem is in archive posts, for test I've set the number of posts per archive by 1 per page and trying with three articles to change the pages.

The paginator is simple this:

<?php get_header(); ?>
</header>
<section class="large-9 columns right-dashed articles">
    <?php if (have_posts ()) : while (have_posts ()) : the_post(); ?>
        <article class="left-icon article" id="post-<?php the_ID(); ?>">
            <a class="permalink" href="<?php echo get_permalink();?>"><h2 class="black"><?php the_title(); ?></h2></a>
            <div class="details"><?php echo __('di:').' '.get_the_author();?> / <time datetime="<?php echo get_the_date('Y-m-d H:i:s');?>"><?php echo get_the_date();?></time></div>
            <div class="entry"><?php the_excerpt(); ?></div>
            <br><br>
            <a class="button" href="<?php echo get_permalink();?>"><?php echo __('Continue to article'); ?></a>
            <br><br><br>
            <hr>
        </article>
    <?php endwhile; endif; ?>
    <footer>
        <?php
        // PAGINATOR
        next_posts_link();
        previous_posts_link();
        ?>
    </footer>
</section>
<aside class="large-3 columns to-right">
    <?php
    // some menu here
    ?>
</aside>
<?php get_footer(); ?>

I'va always had mistakes with permalinks and pages, probably I miss some base concept of WordPress about it.

How can I do to make it work and let WordPress paginate blog pages correctly?

share|improve this question
    
How did you "set the number of posts per archive by 1 per page"? Post that code, please. –  s_ha_dum May 3 '13 at 13:53
    
I did it via wordpress backoffice wp-admin > options > reading –  Vittorio Vittori May 3 '13 at 14:32
    
Something is missing. I have no trouble with next_posts_link and previous_posts-link with the same permalink structure. Something is peculiar about your site. Disable your plugins and switch themes. Try to find what is causing this. –  s_ha_dum May 3 '13 at 14:50
    
I've deactivated all the plug-in installed: Advanced Custom Fields, Disqus Comment System, Flexible Custom Post Type, WPML Multilingual CMS and WPML String Translation, refreshed the page multiple times, but the problem still the same. This is the url I call: site.com/category/page/2 does it points to archive.php or should I point to somewhere else? I'm not using other sub archives. –  Vittorio Vittori May 3 '13 at 16:27

1 Answer 1

check your reading settings. The number of post per page has to be the same in archives too.

share|improve this answer
1  
In archives I didn't set any number of posts, I just set it in reading setting, do you mean there is another place where I should set the number? –  Vittorio Vittori May 3 '13 at 9:45
    
You said: > "for test I've set the number of posts per archive by 1 per page and trying with three articles to change the page", number of posts per page has to be the same as the number set in reading settings. –  JMau May 3 '13 at 11:11
    
sorry for my english, i meant I've set the number of posts per archive by 1 by setting it in wp-admin > options > reading –  Vittorio Vittori May 3 '13 at 14:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.