[wp-hackers] Pagination problem - Is this a bug?
wpmidia lab
wpmidia at gmail.com
Wed Jun 20 22:55:04 UTC 2012
Thank you John!!!
Works! Now [found_posts] => 29
Thanks Bill and John! I will return to my WordPress 3.4 tests! =)
Miriam de Paula
2012/6/20 John Blackbourn <johnbillion+wp at gmail.com>
> On 20 June 2012 22:59, wpmidia lab <wpmidia at gmail.com> wrote:
> > Hi Bill .... Thanks for your answer!
> >
> > I did this:
> >
> > add_action( 'pre_get_posts', 'change_query_from_home' );
> > function change_query_from_home( $query ) {
> >
> > if( $query->is_main_query() && !is_admin() ) {
> > $query->set('post_type', array('post, lab'));
>
> ^ The array in this line should be: array('post', 'lab')
>
> John
>
> > $query->set( 'posts_per_page', '3' );
> > $query->set( 'paged', get_query_var('paged') );
> > }
> > }
> >
> > Now my index returns zero posts!!!
> >
> > found_posts => 0
> >
> > =(
> >
> > I'm very sad...
> >
> >
> >
> > 2012/6/20 Bill Erickson <bill.erickson at gmail.com>
> >
> >> Never use query_posts. If you want to modify the main query, you need to
> >> use the pre_get_posts hook.
> >>
> >> On your site, WordPress 404's (rightly) before it gets to your code that
> >> changes the query.
> >>
> >> More information:
> >> http://www.billerickson.net/customize-the-wordpress-query/
> >>
> >>
> >> ---
> >> Bill Erickson
> >> WordPress Consultant
> >> http://www.billerickson.net
> >>
> >> NOTE: To better serve my clients, partners, and most importantly my
> family,
> >> I've begun checking email only three times per day.
> >>
> >> For phone calls, please schedule here: http://tungle.me/billerickson .
> If
> >> it's an emergency, please call now and leave a voicemail
> >>
> >>
> >>
> >> On Wed, Jun 20, 2012 at 3:31 PM, wpmidia lab <wpmidia at gmail.com> wrote:
> >>
> >> > Hello masters!
> >> >
> >> > I'm having problems with the paging of WordPress 3.4. I use the WP
> >> Pagenavi
> >> > plugin and before I upgrade, everything worked perfectly.
> >> >
> >> > I used *print_r ($ wp_query)* to check what was being loaded. I could
> see
> >> > that in *found_posts *is bringing me only 10 posts. I have 10 posts
> and
> >> 19
> >> > custom posts, 29 posts should not be in found_posts?
> >> >
> >> > After the third page, I get 404 error. Before it was not so, then just
> >> > thought it might be some kind of bug.
> >> >
> >> > Anyone here noticed the same thing?
> >> >
> >> > My index code: http://pastebin.com/N2CRmegW
> >> >
> >> >
> >> >
> >> > Thanks in advance.
> >> > --
> >> > *Míriam de Paula *
> >> > *Twitter:* @miriamdepaula
> >> >
> >> >
> >> > *desenvolvimento web*
> >> > http://wpmidia.com.br
> >> > twitter: @wpmidia
> >> >
> >> > *WordPress Brasil no Facebook:*
> >> > http://www.facebook.com/groups/wordpress.brasil
> >> >
> >> > *OpenCart Brasil no Facebook:*
> >> > http://www.facebook.com/groups/opencart.brasil/
> >> > _______________________________________________
> >> > wp-hackers mailing list
> >> > wp-hackers at lists.automattic.com
> >> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> >
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> >
> >
> >
> > --
> > *Míriam de Paula *
> > *Twitter:* @miriamdepaula
> >
> >
> > *desenvolvimento web*
> > http://wpmidia.com.br
> > twitter: @wpmidia
> >
> > *WordPress Brasil no Facebook:*
> > http://www.facebook.com/groups/wordpress.brasil
> >
> > *OpenCart Brasil no Facebook:*
> > http://www.facebook.com/groups/opencart.brasil/
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
*Míriam de Paula *
*Twitter:* @miriamdepaula
*desenvolvimento web*
http://wpmidia.com.br
twitter: @wpmidia
*WordPress Brasil no Facebook:*
http://www.facebook.com/groups/wordpress.brasil
*OpenCart Brasil no Facebook:*
http://www.facebook.com/groups/opencart.brasil/
More information about the wp-hackers
mailing list