magicdustwebsites of Magicdust
4/30/2016 - 11:40 AM

Featured posts

Featured posts

<!-- Use a Taxonomy field, set to post_tag and to return Term ID. -->

<section class="module  module--featured-posts">
	<div class="container">
		<?php
		$featured_posts_args = array(
		'ignore_sticky_posts' => true,
		'posts_per_page'      => 3,
		);

		if ( get_sub_field( 'tag' ) ) {
			$featured_posts_args['tag_id'] = get_sub_field( 'tag' );
		}

		$featured_posts = new WP_Query($featured_posts_args);

		if ( $featured_posts->have_posts() ) : ?>
			<div class="grid  grid--3-columns">
				<?php while ( $featured_posts->have_posts() ) : $featured_posts->the_post(); ?>
					<div class="grid__column">
						<?php get_template_part( 'template-parts/views/excerpt', get_post_type() ); ?>
					</div>
				<?php endwhile; ?>
			</div>
		<?php endif; wp_reset_query(); ?>
	</div>
</section>