• Resolved GaryKay

    (@garykay)


    Hi,

    I make use of 2 different wp-query.

    <?php 
    
    				      $cat_id = get_cat_ID('conference_categories');
    
    							// WP_Query arguments
    						$args = array (
    						    'cat' => $cat_id,
    							'post_type' => 'meet',
    							'pagination'             => true,
                                                            'page'                  => $paged,
    							'posts_per_page'         => '20',
    							'offset'				=> '0',
    							'orderby' => 'date',
                                'order' => 'DESC',
    							'tax_query' => array(
    							array(
    								'taxonomy' => 'conference_categories',
    								'field' => 'slug',
    								'terms' => 'groundfloor'
    							)
    						)
    						);
    
    						// The Query
    						$stills = new WP_Query( $args );
    
    						// The Loop
    						if ( $stills->have_posts() ) {
    							while ( $stills->have_posts() ) {
    								$stills->the_post(); ?>

    and

    <?php
    						// The Query
    						  $temp = $wp_query;
    						  $wp_query = null;
    						  $wp_query = new WP_Query();
    						  $wp_query->query('showposts=1&post_type=fun&category_name=featured-fun&orderby=date&order=DESC'.'&paged='.$paged); 
    
    						  while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

    The first query works great to target custom taxonomies but I can’t get the pagination to work with this query and the second works great for the pagination but I don’t know how to target custom taxonomies. I don’t mind using either. I would like to be able to filter using custom taxonomies while having the pagination working. Any help would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • In your first query, try changing the ‘page’ arg to ‘paged’.

    $args = array (
           'cat' =>               $cat_id,
          'post_type' =>          'meet',
          'pagination' =>         true,
          'paged' =>              $paged,  // Changed to 'paged'
          'posts_per_page' =>     '20',
          'offset' =>             '0',
          'orderby' =>            'date',
          'order' =>              'DESC',
          'tax_query' => array(
             array(
                'taxonomy' =>     'conference_categories',
                'field' =>        'slug',
                'terms' =>        'groundfloor'
             )
          )
    );
    Thread Starter GaryKay

    (@garykay)

    Thanks vtxyzzy,

    That seemed to do be it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination with wp-query’ is closed to new replies.