I am using Redux Framework for WordPress theme. Then upload logo from redux options panel.
here is my redux option code :
array( 'id' => 'opt_header_logo', 'type' => 'media', 'url' => true, 'title' => __('Logo', 'demo' ), 'compiler' => 'false', 'subtitle' => __('Upload your logo', 'demo' ), 'default' => array('url' => IMAGES . '/logo.png'), ),
here is my display code :
<?php if($redux_demo['opt_header_logo']['url']!='') { ?> <img alt="" src="<?php bloginfo('template_directory'); ?>/images/logo.png"> <?php } else { ?> <img src="<?php global $redux_demo; echo''.$redux_demo['opt_header_logo']['url']; ?>"> <?php } ?>
i want to display default image if image is not uploaded. this code is display uploaded image perfectly but when i delete uploaded image from redux option default image is not showing.
Please help ?
Thanks
Advertisement
Answer
ok finally i got the answer and my code is working fine.
here is my output working code:
<?php global $redux_demo; if($redux_demo['opt_header_logo']['url']!='') { ?> <img src="<?php echo $redux_demo['opt_header_logo']['url']; ?>"> <?php } else { ?> <img alt="" src="<?php bloginfo('template_directory'); ?>/images/logo.png"> <?php } ?>