Created
March 2, 2018 06:21
-
-
Save ahmedmusawir/1eff3fd71d7ab0482a4f6d49785db364 to your computer and use it in GitHub Desktop.
WP - WP_QUERY LOOP - W/ CUSTOM POST TYPE & CUSTOM TAXONOMY
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 | |
$counter = 0; | |
$item_count = 0; | |
$args = array( | |
'post_type' => 'portfolio', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'portfolio-item', | |
'field' => 'slug', | |
'terms' => 'featured' | |
) | |
), | |
'posts_per_page' => 4 | |
); | |
$front_page_post_items = new WP_Query($args); | |
if ($front_page_post_items->have_posts()): /* Start the Loop */ | |
while ($front_page_post_items->have_posts()): | |
$front_page_post_items->the_post(); | |
?> | |
... ... ... | |
... ... ... | |
<?php | |
endwhile; | |
else: | |
get_template_part('template-parts/content', 'none'); | |
endif; | |
wp_reset_postdata(); | |
?> | |
 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment