// Post Formats
$post_formats_array = array(
post'post-format-asideaside',
post'post-format-audioaudio',
post'post-format-chatchat',
post'post-format-gallerygallery',
post'post-format-imageimage',
post'post-format-linklink',
post'post-format-statusstatus',
post'post-format-quotequote',
post'post-format-videovideo'
);
// Custom query args
$standard_posts_query_args = array(
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
// Use array defined above,
// or try omitting 'terms' entirely
'terms' => $post_formats_array,
'operator' => 'NOT IN'
)
)
);
// Custom query
$standard_posts = new WP_Query( $standard_posts_query_args );
// Custom query loop
if ( $standard_posts->have_posts() ) : while ( $standard_posts->have_posts() ) : $standard_posts->the_post();
// Loop markup here
endwhile; endif;
function wpse129372_filter_posts_archive( $query ) {
if ( $query->is_main_query && $query->is_archive() ) {
$post_formats_array = array(
post'post-format-asideaside',
post'post-format-audioaudio',
post'post-format-chatchat',
post'post-format-gallerygallery',
post'post-format-imageimage',
post'post-format-linklink',
post'post-format-statusstatus',
post'post-format-quotequote',
post'post-format-videovideo'
);
$tax_query = array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
// Use array defined above,
// or try omitting 'terms' entirely
'terms' => $post_formats_array,
'operator' => 'NOT IN'
)
);
$query->set( 'tax_query', $tax_query );
}
}
add_action( 'pre_get_posts', 'wpse129372_filter_posts_archive' );