• Hi,

    I have my site https://freecoupon.co.in on wordpress 3.1.3. I had moved that site to another domain https://couponhut.in and upgraded the wp version with 3.5.1 . Now I am facing pagination problem on home page as when I clicked on page 2 it shows the url https://couponhut.in/?paged=2 and throws 404 error. When I changed url https://couponhut.in/?paged=1 manually, it works. Pagination works normally on inner pages like https://couponhut.in/?stores=zoomin&paged=2 . If I change my home url https://couponhut.in/?post_type=coupon&paged=2 again it works.

    My Index.php :

    <?php get_header(); ?>
    <div id="content">	
    
    	<?php if(file_exists(STYLESHEETPATH . '/featured.php')) include_once(STYLESHEETPATH . '/featured.php'); else include_once(TEMPLATEPATH . '/featured.php'); ?>
    
        <div class="content-box">
    
            <div class="box-t">?</div>
    
            <div class="box-c">
    
                <div class="box-holder">
    
                    <div class="head">
    
                        <h2><?php _e('New Coupons', 'appthemes'); ?></h2>
    
    					<div class="counter"><?php printf(__('There are currently %s active coupons', 'appthemes'), '<span>'. appthemes_count_posts(APP_POST_TYPE, 'publish') . '</span>'); ?></div>
    
                    </div> <!-- #head -->
    
                    <?php
                    // show all coupons and setup pagination
                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                    query_posts(array('post_type' => APP_POST_TYPE, 'caller_get_posts' => 1, 'paged' => $paged));
                    ?>
    
                    <?php get_template_part('loop', 'coupon'); ?>
    
                </div> <!-- #box-holder -->
    
            </div> <!-- #box-c -->
    
            <div class="box-b">?</div>
    
        </div> <!-- #content-box -->
    
    </div><!-- #container -->
    
    <?php get_sidebar('home'); ?>
    
    <?php get_footer(); ?>
    
    And I used non plugin version of WP-pageNavi (2.5) in theme function like:
    
    // slimmed down non-plugin version of WP-PageNavi (2.50) by Lester 'GaMerZ' Chan https://lesterchan.net
    function appthemes_pagination($before = '', $after = '') {
        global $wpdb, $wp_query;
    
        if (!is_single()) :
    
            $pagenavi_options = array(
                    'pages_text' => __('Page %CURRENT_PAGE% of %TOTAL_PAGES%','appthemes'),
                    'current_text' => '%PAGE_NUMBER%',
                    'page_text' => '%PAGE_NUMBER%',
                    'first_text' => __('?? First','appthemes'),
                    'last_text' => __('Last ??','appthemes'),
                    'next_text' => '??',
                    'prev_text' => '??',
                    'dotright_text' => '',
                    'dotleft_text' => '',
                    'style' => 1,
                    'num_pages' => 15,
                    'always_show' => 0,
                    'num_larger_page_numbers' => 3,
                    'larger_page_numbers_multiple' => 30,
            );
    
            $posts_per_page = intval(get_query_var('posts_per_page'));
            $paged = intval(get_query_var('paged'));
            $numposts = $wp_query->found_posts;
            $max_page = $wp_query->max_num_pages;
    
            if(empty($paged) || $paged == 0) $paged = 1;
    
            $pages_to_show = intval($pagenavi_options['num_pages']);
            $larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']);
            $larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']);
            $pages_to_show_minus_1 = $pages_to_show - 1;
            $half_page_start = floor($pages_to_show_minus_1/2);
            $half_page_end = ceil($pages_to_show_minus_1/2);
            $start_page = $paged - $half_page_start;
    
            if($start_page <= 0) $start_page = 1;
    
            $end_page = $paged + $half_page_end;
    
            if(($end_page - $start_page) != $pages_to_show_minus_1) $end_page = $start_page + $pages_to_show_minus_1;
    
            if($end_page > $max_page) {
                $start_page = $max_page - $pages_to_show_minus_1;
                $end_page = $max_page;
            }
    
            if($start_page <= 0) $start_page = 1;
    
            $larger_per_page = $larger_page_to_show*$larger_page_multiple;
            $larger_start_page_start = (appthemes_round($start_page, 10) + $larger_page_multiple) - $larger_per_page;
            $larger_start_page_end = appthemes_round($start_page, 10) + $larger_page_multiple;
            $larger_end_page_start = appthemes_round($end_page, 10) + $larger_page_multiple;
            $larger_end_page_end = appthemes_round($end_page, 10) + ($larger_per_page);
    
            if($larger_start_page_end - $larger_page_multiple == $start_page) {
                $larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
                $larger_start_page_end = $larger_start_page_end - $larger_page_multiple;
            }
    
            if($larger_start_page_start <= 0) $larger_start_page_start = $larger_page_multiple;
            if($larger_start_page_end > $max_page) $larger_start_page_end = $max_page;
            if($larger_end_page_end > $max_page) $larger_end_page_end = $max_page;
    
            if($max_page > 1 || intval($pagenavi_options['always_show']) == 1) :
                $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);
                $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
    
                echo $before.'<div class="paging">'."\n";
    
    			if(!empty($pages_text)) echo '<div class="pages"><span class="total">'.$pages_text.'</span>';
    
    			if ($start_page >= 2 && $pages_to_show < $max_page) :
    				$first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']);
    				echo '<a href="'.esc_url(get_pagenum_link()).'" title="'.$first_page_text.'">'.$first_page_text.'</a>';
    
    				if(!empty($pagenavi_options['dotleft_text']))
    					echo '<span class="extend">'.$pagenavi_options['dotleft_text'].'</span>';
    			endif;
    
    			if($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) :
    				for($i = $larger_start_page_start; $i < $larger_start_page_end; $i+=$larger_page_multiple) {
    					$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
    					echo '<a href="'.esc_url(get_pagenum_link($i)).'" title="'.$page_text.'">'.$page_text.'</a>';
    				}
    			endif;
    
    			echo '<span class="prevPage">';
    			// give us the previous post link
    			previous_posts_link($pagenavi_options['prev_text']);
    			echo '</span>';
    
    			for($i = $start_page; $i  <= $end_page; $i++) :
    				if($i == $paged) {
    					$current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']);
    					echo '<span class="current">'.$current_page_text.'</span>';
    				} else {
    					$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
    					echo '<a href="'.esc_url(get_pagenum_link($i)).'" title="'.$page_text.'">'.$page_text.'</a>';
    				}
    			endfor;
    
    			echo '<span class="nextPage">';
    			// give us the next post link
    			next_posts_link($pagenavi_options['next_text'], $max_page);
    			echo '</span>';
    
    			if($larger_page_to_show > 0 && $larger_end_page_start < $max_page) :
    				for($i = $larger_end_page_start; $i <= $larger_end_page_end; $i+=$larger_page_multiple) {
    					$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
    					echo '<a href="'.esc_url(get_pagenum_link($i)).'" title="'.$page_text.'">'.$page_text.'</a>';
    				}
    			endif;
    
    			if ($end_page < $max_page) :
    				if(!empty($pagenavi_options['dotright_text']))
    					echo '<span class="extend">'.$pagenavi_options['dotright_text'].'</span>';
    
    				$last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['last_text']);
    				echo '<a href="'.esc_url(get_pagenum_link($max_page)).'" title="'.$last_page_text.'">'.$last_page_text.'</a>';
    			endif;
    
                echo '</div><div class="clr"></div></div>'.$after."\n";
    
            endif;
    
        endif;
    }

    [Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    Please help me out on the issue.

Viewing 15 replies - 1 through 15 (of 25 total)
  • Have you tried:

    – deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems.

    resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    – re-uploading all files & folders – except the wp-content folder – from a fresh download of WordPress. Make sure that you delete the old copies of files & folder before uploading the new ones.

    Thread Starter callanuragin

    (@callanuragin)

    I have puzzled with this problem since last three days and found this solution given by you on any other similar topic. I have done all these things but still having same problem.

    That site is not using the default 2012 theme and still has active plugins.

    Thread Starter callanuragin

    (@callanuragin)

    I have tried your solutions yesterday and they didn’t worked. Now I have again activated all the plugins and my themes.

    Its working fine on https://freecoupon.co.in but not working in https://couponhut.in .

    There is no magic bullet in these situations. This is just the start of basic troubleshooting and is a process of elimination deliberately designed to locate the root cause as quickly as possible by first removing the most obvious and common culprits via a series of (often) temporary steps.

    Do you want to locate and, hopefully, fix the problem on your site? If “yes”, then please help us to help you and carry out the changes that we suggest.

    Thread Starter callanuragin

    (@callanuragin)

    Now I have deactivated all the plugins again and switched the theme to 2012

    Thread Starter callanuragin

    (@callanuragin)

    Of course Esmi .. Thanx for your earlier support

    Thread Starter callanuragin

    (@callanuragin)

    Shall I reactivate them or wait for your response?

    Could you point me to your main posts page?

    Thread Starter callanuragin

    (@callanuragin)

    I have custom post type coupon and showing them in front page so it can be poited only when I activate my custom theme. its just https://couponhut.in or couponhut.in/?post_type=coupon

    So you’re supposed to be using a static front page with a custom query for your home page? If so, have you reviewed creating a static front page?

    Thread Starter callanuragin

    (@callanuragin)

    Its not a custom static page. Its just custom post type coupon and on reading panel I have selected the ‘Your latest post’ option

    So your theme’s index.php template file uses a custom query, yes?

    Thread Starter callanuragin

    (@callanuragin)

    It is working as it is on https://freecoupon.co.in with wp 3.1.3

    Thread Starter callanuragin

    (@callanuragin)

    Yes I have custome query in index.php and shown above at initial

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘pagination not working on home page’ is closed to new replies.