• So I can’t figure out why this conditional statement simply doesn’t work:

    if ( meta('additional-information') == '' ) {
    echo "Its empty";
    } elseif ( meta('additional-information') != '' ) {
    echo "Its got something!";
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • you might want to try and find out if meta() is actually a wordpress function.

    Thread Starter Spencer Hill

    (@ws5f3dj7)

    I can’t find information in the codex, but I can’t find information elsewhere in the PHP manuals. I’m almost certain it is as it’s pulling meta from the “meta” tables inside WordPress that is central to plugin development, and plenty of other things.

    Thanks for your reply!

    The meta in wordpress you cna find here: http://codex.wordpress.org/Custom_Fields

    but if you want to use meta in your header you should try to find a plugin or write the code yourself

    Perhaps you mean to be using the WordPress function the_meta()?
    http://codex.wordpress.org/Function_Reference/the_meta

    Thread Starter Spencer Hill

    (@ws5f3dj7)

    You know what, I realized that this is a custom function from the “Reusables” plugin. Sorry for that mix up. Though, ultimately my problem (as far as I can see) isn’t with the function itself, but the way the information is returning to my conditional statements. Or maybe my syntax is wrong and I’m just blind from staring at it so long.

    Thanks for the link Valandil. I’m not sure I understood your comment about using meta in my header, as that’s not what we’re talking about. But thank you anyway.

    Chip, thanks for the reference, sorry for the mixup on my part.

    And that’s why Plugins (and Themes) should be following best practices regarding naming custom functions, by prefixing them uniquely, e.g. with the Theme/Plugin slug.

    Thread Starter Spencer Hill

    (@ws5f3dj7)

    Couldn’t agree more!

    Thread Starter Spencer Hill

    (@ws5f3dj7)

    Turns out I was suppose to be using geta_meta(). I found this out by searching for “function meta(” in the WordPress More Fields plugin files.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘If meta() is empty, then… need help…’ is closed to new replies.