-
-
Save matgargano/99657a4896c8c6a3074d6867c6d18153 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' => -1, // change this to any number or '0' for all | |
'post_type' => 'page', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => 'behavior', | |
) | |
) | |
); | |
// 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