Support » Fixing WordPress » Paginated Page end up with 404 in 2nd page

  • Resolved sanjevi25

    (@sanjevi25)


    I have a paginated built in my theme. However, the pages linked, though the slugs are correct, give me 404 errors. I’ve tried everything, even changing the way pagination was achieved and flushing my rewrite rules several times.

    Example:
    http://quoteta.com/ works fine, while
    http://quoteta.com/page/2/ gives a very not so welcome 404 error or a blank page.
    Here is my codings :

    <?php get_header(); ?>
    
    <?php if (is_archive()) $post_number = get_option('dailynotes_archivenum_posts');
    if (is_search()) $post_number = get_option('dailynotes_searchnum_posts');
    if (is_tag()) $post_number = get_option('dailynotes_tagnum_posts');
    if (is_category()) $post_number = get_option('dailynotes_catnum_posts');
    if (is_home()) $args=array(
    					   'showposts'=>get_option('dailynotes_homepage_posts'),
    					   'paged'=>$paged,
    					   'post_type' => array('note','photo','quote','video','customlink','audio','post')
    					); ?>
    
    <?php global $query_string;
    if (is_category()) query_posts($query_string . "&showposts=$post_number&paged=$paged&cat=$cat");
    elseif (is_home()) query_posts($args);
    elseif (is_author()) {
    	$qstring_array = array();
    	parse_str($query_string,  $qstring_array);
    	query_posts(array('showposts' => $post_number,'paged'=>$paged,'post_type' => array('note','photo','quote','video','customlink','audio'),'author'=>$qstring_array["author"])) ; }
    else query_posts($query_string . "&showposts=$post_number&paged=$paged"); ?>
    
    <?php
    if (isset($_REQUEST["post_type"])) {
    	$args=array(
    	   'showposts'=> get_option('dailynotes_archive_customposts'),
    	   'paged'=>$paged,
    	   'post_type' => $_REQUEST["post_type"]
    	);
    	query_posts($args);
    }; ?>
    
    <div id="posts_big">
    	<?php  $i = 0; if (have_posts()) : while (have_posts()) : the_post(); $i++; ?>
        <?php include(TEMPLATEPATH . '/includes/entry2.php'); ?>
        <?php endwhile; ?>
        <?php endif; wp_reset_query(); ?>
    </div>	
    
    <?php if (is_archive()) $post_number = get_option('dailynotes_archivenum_posts');
    if (is_search()) $post_number = get_option('dailynotes_searchnum_posts');
    if (is_tag()) $post_number = get_option('dailynotes_tagnum_posts');
    if (is_category()) $post_number = get_option('dailynotes_catnum_posts');
    if (is_home()) $args=array(
    					   'showposts'=>get_option('dailynotes_homepage_posts'),
    					   'paged'=>$paged,
    					   'post_type' => array('note','photo','quote','video','customlink','audio','post')
    					); ?>
    
    <?php global $query_string;
    if (is_category()) query_posts($query_string . "&showposts=$post_number&paged=$paged&cat=$cat");
    elseif (is_home()) query_posts($args);
    elseif (is_author()) {
    	$qstring_array = array();
    	parse_str($query_string,  $qstring_array);
    	query_posts(array('showposts' => $post_number,'paged'=>$paged,'post_type' => array('note','photo','quote','video','customlink','audio'),'author'=>$qstring_array["author"])) ; }
    else query_posts($query_string . "&showposts=$post_number&paged=$paged"); ?>
    
    <?php
    if (isset($_REQUEST["post_type"])) {
    	$args=array(
    	   'showposts'=> get_option('dailynotes_archive_customposts'),
    	   'paged'=>$paged,
    	   'post_type' => $_REQUEST["post_type"]
    	);
    	query_posts($args);
    }; ?>
    <?php global $default_colorscheme,$shortname;
    $colorSchemePath = '';
    $colorScheme = get_option($shortname . '_color_scheme');
    if ($colorScheme <> $default_colorscheme) $colorSchemePath = strtolower($colorScheme) . '/'; ?>
    <div id="posts">
    	<?php next_posts_link('<img id="next2" src="'.get_bloginfo('stylesheet_directory').'/images/'.$colorSchemePath.'/'.'arrow.gif" alt="next page" />', 0); ?>
        <?php previous_posts_link('<img id="previous2" src="'.get_bloginfo('stylesheet_directory').'/images/'.$colorSchemePath.'/'.'previous.gif" alt="next page" />', 0); ?>
    
         <?php $i = 0; if (have_posts()) : while (have_posts()) : the_post(); $i++; ?>
    
            <?php include(TEMPLATEPATH . '/includes/entry.php'); ?>
    
        <?php endwhile; ?>
    
        <?php endif; wp_reset_query(); ?>	
    
    	<div id="footer"><?php _e('Created by ','Sanjevi Rau'); ?> <a href="#">Sanjevi.R</a></div>
    </div>			
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Can anoyone find me a solution for this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try putting this after <?php get_header(); ?>:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>

    Since this is a commercial theme with its own functionality and support system, I recommend you contact the theme developer or theme vendor for assistance.

    It is still the same after putting the code . The problem is I got this template from the random sites in google .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Paginated Page end up with 404 in 2nd page’ is closed to new replies.