Help needed with 'else' statement
-
Hi folks,
Im fairly new to php and would like some help. I’m using a plugin that gives users the ability to add custom fields to categories. I have utilised the plugin so that i can add an associated image to each category. I found some code on another forum topic that allowed me to do this and it worked perfectly. However, not all my categories have images and i would like to modify the code so that i have an ‘else’ statement which would make wordpress leave that area on the page blank rather than the current small blue box which appears indicating that there is no image associated. I have tried myself to do this yet to no joy. If anyone could help i would be very grateful. The code is as follows…
<?php
$thisCat = $ps_catid;
$thisCatName = $ps_catname;
if(function_exists(‘get_terms_meta’)) {
$screen = get_terms_meta($thisCat, ‘banner’);
$screen = $screen[0];} ?>
<div id=”HomePanel-thin”>
<img src=”<?php echo ($screen); ?>” />
</div>
- The topic ‘Help needed with 'else' statement’ is closed to new replies.