• I’ve got this weird problem:

    pagination on my website is working properly only IF I display a list of posts belonging to JUST TO ONE category.
    If I display a list of posts coming from different categories, pagination is NOT working anymore and on the second page /page/2 I get the message “nothing found”.

    An idea on how to let pagination working on pages which lists posts belonging to different categories?

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • tctc,

    Can you please provide the URL of your site? Thank you.

    Thread Starter tctc

    (@tctc)

    http://www.snowboarditaliamag.it/mag/magazine (user: sim pass: simcity)
    This is the page which is taking me crazy…

    Please note that this page displays posts coming from 11 different subcategories of category parent category ‘mag’. They are extracted using this query:

    <?php if (is_category('magazine')) { ?>
    <h1>SNOWBOARD ITALIA MAGAZINE</h1><p>tutti gli articoli mag</p>
    <?php query_posts('cat=28,38,39,43,44,45,60,69,77,78,85'); ?>  <!-- tira fuori le 8 categorie del menu MAG + update, prodotti-aziende, people-team -->
    <?php } elseif (is_category('board-sport')) { ?>
    <h1>ALTRI BOARD SPORT</h1><p>testo libero statico</p>
    <?php global $query_string; query_posts($query_string); ?>
    <?php } elseif (is_category('english')) { ?>
    <h1>NEWS IN ENGLISH</h1><p>testo libero statico</p>
    <?php global $query_string; query_posts($query_string); ?>
    <?php } elseif (is_category('eventi-contest')) { ?>
    <h1>EVENTI E CONTEST</h1><p>testo libero statico</p>
    <?php global $query_string; query_posts($query_string); ?>
    <?php } elseif (is_category('interviste')) { ?>
    <?php } else { ?><?php } ?>

    and pagination works with this:

    <div class="pagination">
    
    <?php if (function_exists("pagination")) {
        pagination($additional_loop->max_num_pages);
    } ?>
    
     </div>

    where function pagination is:

    function pagination($pages = '10', $range = 3)
    {
         $showitems = ($range * 2)+1; 
    
         global $paged;
         if(empty($paged)) $paged = 1;
    
         if($pages == '')
         {
             global $wp_query;
             $pages = $wp_query->max_num_pages;
             if(!$pages)
             {
                 $pages = 1;
             }
         }  
    
         if(1 != $pages)
         {
             echo "<div class=\"pagination\"><span class=\"pagbg\">Pagina ".$paged." di ".$pages."</span>";
             if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
             if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Successivi</a>";
    
             for ($i=1; $i <= $pages; $i++)
             {
                 if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
                 {
                     echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
                 }
             }
    
             if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Precedenti &rsaquo;</a>";
             if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
             echo "</div>\n";
         }
    }

    which is working fine on the other pages….

    Thanks!

    Thread Starter tctc

    (@tctc)

    well… I noticed that if I change the first query in a way that it recall only one category (mother), the children categories are shown but pagination IS NOT working… always the same error ‘nothing found’….

    <?php if (is_category('magazine')) { ?>
    <h1>SNOWBOARD ITALIA MAGAZINE</h1><p>tutti gli articoli mag</p>
    <?php query_posts('cat=61'); ?>
    <?php } elseif (is_category('board-sport')) { ?>
    <h1>ALTRI BOARD SPORT</h1><p>testo libero statico</p>
    <?php global $query_string; query_posts($query_string); ?>
    ........
    <?php } else { ?><?php } ?>

    I really think it is a problem of query and variables as for the other queries for the other children categories of Mag, pagination works fine…. please help I’m getting crazy with that and already tried thousands of query!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PAGINATION PROBLEM’ is closed to new replies.