Advertisement
mrwweb

Shortcode that doesn't work with tax_query

Feb 25th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. // Current problem: doesn't seem to use the tax_query. No idea why. I've confirmed that $cat is the right value and is getting passed to the query.
  2. // Expected output: 3 pages with the term I've been using for testing
  3. // Real output: All published pages, ordered by menu order...
  4. <?php
  5. $pl_args = array(
  6.     'post_type' => 'page',
  7.     'tax_query' => array(
  8.         array(
  9.             'taxonomy' => 'seg_proj_cats',
  10.             'field' => 'slug',
  11.             'terms' => $cat
  12.         )
  13.     ),
  14.     'orderby' => 'menu_order',
  15.     'posts_per_page' => -1
  16. );
  17. $pl_pages = new WP_Query( $pl_args );
  18.  
  19. if ( $pl_pages->have_posts() ) : while ( $pl_pages->have_posts() ) : $pl_pages->the_post(); ?>
  20.  
  21.     <a class="seg-proj" href="<?php the_permalink(); ?>"><?php the_title() . the_post_thumbnail( $post->ID, 'react-thumb' ); ?></a>
  22.  
  23. <?php endwhile; endif; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement