22 lines
1014 B
PHP
22 lines
1014 B
PHP
<div style="width: 100%; max-width: 250px; 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' => 'side-large-square', // 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 if(get_field('custom_code')!=""){the_field('custom_code');}else{?><a href="<?php the_field('link');?>" title="<?php the_field('title');?>" target="_blank"><img src="<?php the_field('ad_image');?>" class="img-responsive center-block" alt="<?php the_field('title');?>" /></a><?php }?>
|
|
<?php endwhile; wp_reset_postdata(); ?>
|
|
<?php else : endif; ?>
|
|
|
|
</div>
|