Hi,
I’m doing some changes on a WP site using simple fields, which i’m not very confident with.
I have two field types, post and url. And if the post field is empty (no post selected) i want to output the value of the url field. The problem is if nothing is selected in the post field it still gets a value of 0.
Here is my code:
<?php
$slide_url = simple_fields_value('slideshow_slide_url');
$slide_extern_url = simple_fields_value('slideshow_slide_extern_url');
$slide_readmore = (is_numeric($slide_url)) ? '<a href="'.get_permalink($slide_url).'">Read more »</a>' : '<a href="'.$slide_extern_url.'" target="_blank">Read more »</a>';
?>
<?php echo $slide_readmore; ?>
I have not written this code,except the else part of the shorthand. Also I would want to not output any markup if none of these field has values. Is this possible? Would be very thankful for help.