22 lines
731 B
PHP
22 lines
731 B
PHP
|
|
<div style="width: 100%; max-width: 468px; margin: 0 auto; padding: 0;">
|
||
|
|
<?php
|
||
|
|
$query = new WP_Query( array(
|
||
|
|
'post_type' => 'dfads',
|
||
|
|
'posts_per_page' => 1,
|
||
|
|
'orderby' => 'rand',
|
||
|
|
'tax_query' => array (
|
||
|
|
array(
|
||
|
|
'taxonomy' => 'dfads_group', // My Custom Taxonomy
|
||
|
|
'terms' => 'header-group', // My Taxonomy Term that I wanted to exclude
|
||
|
|
'field' => 'slug', // Whether I am passing term Slug or term ID
|
||
|
|
'operator' => 'IN', // Selection operator - use IN to include, NOT IN to exclude
|
||
|
|
),
|
||
|
|
),
|
||
|
|
) );
|
||
|
|
if ( $query->have_posts() ) : ?>
|
||
|
|
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
|
||
|
|
<?php the_content();?>
|
||
|
|
<?php endwhile; wp_reset_postdata(); ?>
|
||
|
|
<?php else : endif; ?>
|
||
|
|
|
||
|
|
</div>
|