Created
August 24, 2016 15:17
-
-
Save ckschmieder/c21ea6bd7bd5ac8012550a8ddd23763c to your computer and use it in GitHub Desktop.
Want to loop thu PAGES with the category slug 'behavior'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $post; | |
$my_query_args = array( | |
'posts_per_page' => 0, // change this to any number or '0' for all | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => 'behavior', | |
'post_type' => 'page' | |
) | |
) | |
); | |
// a new instance of the WP_query class | |
$my_query = new WP_Query( $my_query_args ); | |
if( $my_query->have_posts() ) : while( $my_query->have_posts() ) : $my_query->the_post(); ?> | |
<li><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li> | |
<?php endwhile; endif; wp_reset_postdata(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment