WordPress.org

Support

Support » How-To and Troubleshooting » tax_query and pagination

tax_query and pagination

  • I’m developping a site qith a series of taxonomies and custo fileds and i have an advanced seach form with predefinid dropdon that allow to select taxonomies and other condition.

    I pass this through POST to a page template that based on this data make the query using tax_query etc. It all works fine i get the corretc posts in the correcct taxonies combination, but if i go to next page (using template tags for next page) the POST data obviusly do not pass trhought and second page returns the whole data with no taxonomies filtering.

    I wonder if there is an easy way to kepp pagination or i have to make the pagination link manually attacching to them allafilter data and page using get.

    I love new method for custom query but i’m getting mad with apgination.

    Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • with your query add the $paged as like below:

    $wp_query->query(‘cat=29&showposts=42′.’&paged=’.$paged);

    I know that method but it’s not working cause the page template use some POST data and page other than first one that gets the POST data fail… i can avoid to do the serach if i’m on page 2 or higher but looks like it’s not working…

    My question is ho i can force the query without having to read the post data and construct the query in the page template… so the pagination should works by default.

    I think you have the same error that I ran into awhile back, the thing is that with WordPress as soon as you run a $query_posts it will overwrite all the original page code that would be there by default. (the $query_string). Without that information WordPress cannot paginate correctly.
    So what you want to do is retain some of this information, I did it with:

    global $query_string;
    $myquery = wp_parse_args($query_string);

    Then I added:

    $myquery = array(
    'paged'=>$paged,
    'numberposts'=>-1,
    'tax_query' => array( DO YOUR TAX QUERY HERE

    this worked for me 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘tax_query and pagination’ is closed to new replies.