logo

$4
Flutter Help

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.

WP Answers | 08/13/10 at 3:59pm | Edit


(2) Possible Answers Submitted...

  • avatar
    Last edited:
    08/13/10
    4:28pm
    Mike Truese says:

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

    • 08/13/10 4:28pm

      WP Answers says:

      Thanks Mike. Works like a charm.

  • avatar
    Last edited:
    08/13/10
    4:23pm
    Pippin Williamson says:

    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 "".

This question has expired.





Current status of this question: Completed