WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] /page/46/ page not found (6 posts)

  1. wordmotes
    Member
    Posted 1 year ago #

    Hi folks,

    some days ago I noticed that I had some trouble with older post navigation. The navigation works fine till /page/45/ and with /page/46/ and following I get the response page not found. Just take a view yourself at gomotes.com

    The only things I updated was Worpress to version 3.4.1 and the theme Twenty Ten to version 1.4. I updated now to version 3.4.2 but the problem is still there.

    I've no clue why is the problem at /page/46/ and didn't start with /page/2/ :confused:

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    Did you put a query on the loop in Twenty Ten's index.php?

    http://codex.wordpress.org/Pagination#Troubleshooting_Broken_Pagination

  3. wordmotes
    Member
    Posted 1 year ago #

    Hi

    I used a query in the index.php before the loop starts.

    <?php if ( is_front_page() ) {
                         query_posts($query_string . "&showposts=1"); }
                      ?>
    
    			<?php
    			/* Run the loop to output the posts.
    			 * If you want to overload this in a child theme then include a file
    			 * called loop-index.php and that will be used instead.
    			 */
    			 get_template_part( 'loop', 'index' );
    			?>

    I take a look into loop.php and there I can't found a query question.

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    Try removing this from index.php:

    <?php if ( is_front_page() ) {
                         query_posts($query_string . "&showposts=1"); }
                      ?>

    And adding this to your theme's functions.php

    function my_post_queries( $query ) {
      // do not alter the query on wp-admin pages and only alter it if it's the main query
      if (!is_admin() && $query->is_main_query()){
    
        // alter the query for the home page
    
        if(is_home()){
          $query->set('posts_per_page', 1);
        }
    
      }
    }
    add_action( 'pre_get_posts', 'my_post_queries' );

    http://codex.wordpress.org/Pagination#Removing_query_posts_from_the_main_loop

    btw:
    consider creating a child theme instead of editing Twenty Ten directly - if you upgrade the theme all your modifications will be lost.

  5. wordmotes
    Member
    Posted 1 year ago #

    Thanks so much it worked! I could hug you now! You made a sad men damn happy for the moment. :)

    Yes I noticed. I should take a closer look to the child theme. Now I updated the files for my self.

  6. keesiemeijer
    moderator
    Posted 1 year ago #

    You're welcome. I'm glad you got it resolved! :-)

Topic Closed

This topic has been closed to new replies.

About this Topic