Support » Fixing WordPress » Can't get pagination to work on archive

  • I can’t seen to get pagination to work on archive pages. It works just fine on custom pages and search results, but on archives, everytime I go to page 2 (and onwards) I get a 404 error.
    I looked it up, and it seems like it’s a query error, but I understand very little about it, I couldn’t get any of the solutions I found to work for me. Either nothing different happened, or they’d just get all the posts from the blog, instead of just the ones from a certain category, author, etc.

    This is my archive.php

    <?php get_header(); ?>
    	<div id="corpo">
    		<div class="atualizado">
    			<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    			<?php if (is_category()) { ?>
    				Category: <b><?php echo single_cat_title(); ?></b>
    			<?php } elseif (is_tag()) { ?>
    				Tag: <b>"<?php echo single_tag_title(); ?>"</b>
    			<?php } elseif (is_day()) { ?>
    				Day: <?php the_time('F j Y'); ?>
    			<?php } elseif (is_month()) { ?>
    				Month: <?php the_time('F Y'); ?>
    			<?php } elseif (is_year()) { ?>
    				Year: <?php the_time('Y'); ?>
    			<?php } elseif (is_author()) { ?>
    				Author: <?php the_author(); ?>
    			<?php } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    			<?php } ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post">
            		<div class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="Link para: '<?php the_title(); ?>'"><?php the_title(); ?></a></div>
        			<div class="postcontent"><?php global $more; $more = 0; the_content('Read more'); ?></div>
    		<?php endwhile; ?>
    		<?php else : ?>
    		<?php endif; ?>
    		<?php wp_pagenavi(); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>


Viewing 1 replies (of 1 total)
  • Moderator Jose Castaneda



    Have you tried deactivating all your plugins? Does this happen if you use a bundled theme like twenty fourteen/fifteen?

    What happens if you try resaving the permalink structure?

Viewing 1 replies (of 1 total)
  • The topic ‘Can't get pagination to work on archive’ is closed to new replies.