Hi,
Im trying to get a thumbnail from a custom post type to display on a particular page/post etc. depending on the conditional tag that has been included in the custom field of that post.
For example is_home() is_page(22) etc.
I can get the thumbnail to appear on all the pages but when I use an if statement with get_post_meta conditional tag it doesnt work
<?php if ( get_post_meta($post->ID, 'ad-location', true) ) { ?>
global $post;
$args = array( 'numberposts' => 1, 'post_type' => 'advert' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
the_post_thumbnail('header1-ad');
endforeach;
<?php } ?>
Ive been using simple ad manager but its overboard for what I need