Created
September 26, 2012 16:29
-
-
Save jlittlejohn/3789018 to your computer and use it in GitHub Desktop.
WP: Query Database
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 | |
$args = array( | |
'post_type' => 'slide-show', | |
'post_status' => 'publish', | |
'orderby' => 'menu_order', | |
'order' => 'DESC', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'slide-show-category', | |
'field' => 'slug', | |
'terms' => 'home' | |
) | |
) | |
); | |
$loop = new WP_Query( $args ); | |
$i = 0; | |
if ($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post(); | |
$i++; | |
// $postCount = count($posts); | |
$image = get_field('add_image'); | |
?> | |
<div class="<?php if ($i == 1) { echo 'active'; } ?> item"> | |
<?php the_title(); ?> | |
<?php echo $image['description']; ?> | |
<img src="<?php echo $image['sizes']['homepage-slide']; ?>" alt=""> | |
</div> | |
<?php endwhile; endif; wp_reset_postdata();?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment