Conditional tag in custom field
-
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
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Conditional tag in custom field’ is closed to new replies.