If /else does not work with empty fields
-
Hello! I need help to solve this problem. How I can hide the data in a custom field that is empty? I tried many ways and I’m breaking my head.
<div class="flexslider"> <ul class="slides"><li><?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '<a href="' . $large_image_url[0] . '" rel="lightbox[usb]" . title="' . the_title_attribute('echo=0') . '" >'; the_post_thumbnail('medium'); echo '</a>'; } ?></li> <?php $fotos = get_order_field('fotos_fotos'); if($fotos != ''){ foreach($fotos as $foto){ // el segundo parametro de la función get y get_image es el indice del grupo a mostrar print '<li>'; printf('<a href="%s" rel="lightbox[usb]">', get('fotos_fotos',1,$foto) ); printf('%s', get_image('fotos_fotos',1,$foto) ); print '</a>'; print '</li>'; } } else { print ''; } ?> </ul> </div>
- The topic ‘If /else does not work with empty fields’ is closed to new replies.