bartulans
11/24/2017 - 9:36 AM

get posts by post format

get posts by post format

<?php $myposts = new WP_Query( array(
								'posts_per_page' => 2,
							    'tax_query' => array(
							        array(                
							            'taxonomy' => 'post_format',
							            'field' => 'slug',
							            'terms' => array( 
							                'post-format-image'
							            ),
							            'operator' => 'NOT IN'
							        )
							    )
							));
							// Open the loop
							if ( $myposts->have_posts() ) : while ( $myposts->have_posts() ) : $myposts->the_post(); ?>
								<div class="row">
									<div class="col-md-2">
										<p class="date"><span class="day"><?php the_time('j'); ?></span><i>/</i><span class="month"><?php the_time('m'); ?></span></p>
									</div>
									<div class="col-md-9">
										<a class="highlite-sm" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
										<p><?php the_excerpt(); ?></p>
									</div>
								</div> 
							<?php endwhile; endif; wp_reset_postdata();  ?>