If Stament for fields value
-
Hi guys
So I have two options in Post Edit. One to add a Logo and one to add a Title. On the front end (in my template) I want to show either the Logo or the Title, but not both.
I added this code however it is not working:<?php if( rwmb_meta('restauranttheme_hero_small_logo', false, 'url') !== '' ) { ?> <?php $images = rwmb_meta( 'restauranttheme_hero_small_logo', 'type=image_advanced&size=full' ); foreach ( $images as $image ) { echo "<img src='{$image['url']}'>"; } ?> <?php } else { ?> <h1 class="mini-title"><?php echo rwmb_meta('restauranttheme_hero_title' ); ?></h1> <?php } ?> I also tried:
<?php if( ” != rwmb_meta(‘restauranttheme_hero_small_logo’ ) ) { ?>
<?php $images = rwmb_meta( ‘restauranttheme_hero_small_logo’, ‘type=image_advanced&size=full’ );
foreach ( $images as $image ) {
echo “<img src='{$image[‘url’]}’>”; } ?>
<?php } else { ?>
<h1 class=”mini-logo”><?php echo rwmb_meta(‘restauranttheme_hero_title’ ); ?></h1>
<?php } ?>I guess the error is in my if else statement.
Can anyone help?Thanks so much
- The topic ‘If Stament for fields value’ is closed to new replies.