Support » Plugins » [Plugin: Flutter] Hiding Label When Key is Blank

  • Fresh Page is great! But am having the most obnoxious issue. There is probably a simple solution and I’m just missing it.

    So when creating a post using Flutter, I often times only fill out about half of the fields I’ve created. But Flutter still creates custom fields for every field, simply leaving them blank. I’m using the following code to display the custom fields in my loop:

    <?php $customField = get_post_custom_values("name");
    if (isset($customField[0])) {
        echo "Name: ".$customField[0]."<br />";
    } ?>

    The problem is that since Flutter still creates the custom fields, but leaving them blank, I am still left with the label “Name:” on my post. How can I make the code conditional so if the custom field is blank, the label is not displayed?

Viewing 1 replies (of 1 total)
  • I’ve just started using Flutter, but I had a similar issues. I was using flutter’s simplest get(‘variable’) syntax. By default Flutter surrounds textbox fields with some HTML, so my empty fields were not really empty.

    You can fix this if you specify full arguments for the get() function like this:

    $myFlutterField = get('myFlutterField', 1, 1, false);

    The false argument at the end stops any html surrounding the value. So you can then use:

     //output value here

    See the Flutter usage page for full info on the get() function.

    Hope this helps

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Flutter] Hiding Label When Key is Blank’ is closed to new replies.