[wp-trac] [WordPress Trac] #19985: Query_posts paged not working for subcategories when mixing custom post types

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 7 20:43:48 UTC 2012


#19985: Query_posts paged not working for subcategories when mixing custom post
types
--------------------------+-------------------------------
 Reporter:  novakpeter    |      Owner:  mike@…
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Types    |    Version:  3.3.1
 Severity:  major         |   Keywords:
--------------------------+-------------------------------
 {{{
        $page = (get_query_var('paged')) ? get_query_var('paged') : 1;

        if (is_category('news') OR is_category('events')){
         query_posts(array('post_type'=>array('post','ai1ec_event'),'paged'
 => $page));
        }

        if(have_posts()) : while(have_posts()) : the_post();
 }}}

 I have this code in themes category.php. It mixes two post types, standard
 posts and events from All in One Events Calendar (WP plugin). It works
 almost perfect. "News" is a normal category, in this category the loop
 lists normal posts, events and makes a proper pagination.

 "Events" is a subcategory of "News". If I am in "Events" category, the
 loop lists normal posts together with events. BUT: the pagination doesnt
 work properly. If I click on previous_posts_link generated link, the URL
 is proper:

 {{{
 http://www.domain.com/categories/news/events/page/2/
 }}}

 BUT, on the page are mixed posts from news and events category together
 and clicking on previous_posts_link generated link leads to page 3, which
 "doesnt exist".

 SO, THE SAME CODE WORKS PERFECTLY ON A CATEGORY, FAILS PAGING ON
 SUBCATEGORY

 If you want, I can give you FTP details to see it in action.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19985>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list