Conditional Statements
-
The current code below controls what text is added as an overlay on the page banners for each custom post type (products, people, and news). I am trying to add a new statement to display custom text on one particular news post.
Any ideas?
<?php /**Displaying Custom Field Data**/ $featuredtext = get_post_meta( $post->ID, 'featured-text', true ); if( ! empty( $featuredtext ) && ! is_search() ) { foreach( $featuredtext as $text) { echo '<div class="banner-text"><span>'.$text['featured-image-text'].'</span></div>'; } } elseif ($current_posttype == 'products' || is_search()) { echo '<div class="banner-text"><span>' . get_option('prodFeaturedText') . '</span></div>'; } elseif ($current_posttype == 'people') { echo '<div class="banner-text"><span>' . get_option('peopleFeaturedText') . '</span></div>'; } elseif ($current_posttype == 'news') { echo '<div class="banner-text"><span>' . get_option('newsFeaturedText') . '</span></div>'; } ?>
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Conditional Statements’ is closed to new replies.