Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Flutter Help WordPress

  • SOLVED

Hi Experts,

I am using flutter for use of custom post types ( http://wordpress.org/extend/plugins/fresh-page/ )

Everything is working fine, however I have a question about displaying the content.

If you've never used flutter, here is the code you use to display a value from one of your custom fields:


<? echo get('event_link'); ?>


I need help writing an if statement so that it only displays the value if the field has been filled in. If it is not filled in it should display nothing.

Logically, I'm thinking it should work like this:


if fieldvalue doesn't equal anything, display nothing, else display <a href="fieldvalue">Register</a>


I appreciate any help you can provide.

Cheers.

Answers (2)

2010-08-13

Mike Truese answers:

<?
$event_link = get('event_link');
if ($event_link != "") { ?>
<a href="<?php echo $event_link; ?>">Register</a>
<? }; ?>


WP Answers comments:

Thanks Mike. Works like a charm.

2010-08-13

Pippin Williamson answers:

I'll improve upon what Mike said:


<?
$event_link = get('event_link');
if ($event_link != null) { ?>
<a href="<?php echo $event_link; ?>">Register</a>
<? }; ?>


In this case, null is better to use than "".