Advertisement
Guest User

Query Code

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <ul class="publicationCatList">
  2. <?php
  3. if( is_category(14) ) {
  4.  
  5. //get a list of Practice Area posts in the Business category
  6. $args = array(
  7. 'post_type' => 'practice_areas',
  8. 'posts_per_page'=>'-1',
  9. 'order' => 'ASC',
  10. 'orderby' => 'post_title',
  11. 'tax_query' => array(
  12. array(
  13. 'taxonomy' => 'category',
  14. 'terms' => 14,
  15. ),
  16. ),
  17. );
  18.  
  19. $my_query = new WP_Query( $args );
  20.  
  21. if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
  22.  
  23. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  24.  
  25. <?php endwhile;
  26. wp_reset_postdata();
  27. endif;
  28. }
  29. ?>
  30. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement