• Resolved orvokki

    (@orvokki)


    Hello everyone,

    I know there’ve been a lot of such posts, however, I couldn’t find a solution to my problem.
    As the topic says, when I click on next page I get a 404 error.

    I don’t know what is wrong with my code, because I’ve only copied it from my other website, where it works fine!

    The code:

    <?php
    		$news = $wp_query;
    		$wp_query = null;
    		$wp_query = new WP_Query();
    		$wp_query->query('showposts=4'.'&paged='.$paged);
    		?>
    		<?php if (have_posts()) : ?>
      		<?php while (have_posts()) : the_post(); ?>
    
    		<hr>
    		<h2><?php the_title(); ?></h2>
    		<p><?php the_content(); ?></p> 
    
    		<?php endwhile; ?>
    		<?php else : ?>
    		... no posts.
    		<?php endif; ?>
    
    		<div class="navigation">
    		<div class="prev"><?php previous_posts_link('? Previous') ?></div>
    		<div class="next"><?php next_posts_link('Next ?') ?></div>
    		</div>
    
    		<?php $wp_query = null; $wp_query = $myqueryname;?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter orvokki

    (@orvokki)

    well… finally have found a solution. I had to set posts per page in backend to be smaller than in the code above…
    funny bug and do much time spent on it! :/

    Thread Starter orvokki

    (@orvokki)

    resolved of course.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination – error 404 on page 2’ is closed to new replies.