WordPress.org

Support

Support » Plugins and Hacks » Custom Fields Creator » [Resolved] [Plugin: Custom Fields Creator] Hide if empty

[Resolved] [Plugin: Custom Fields Creator] Hide if empty

  • <?php $Status = get_post_meta($post->ID, "Status", true); ?>
    <?php foreach($Status as $Status) { echo $Status ['status']; } ?>

    That is the code I’m using. It works fine except for posts that do not have the newly created field added, I get this error on the posts:
    Warning: Invalid argument supplied for foreach() in /***/archive.php on line 32

    What am I doing wrong and how would I fix it?

    http://wordpress.org/extend/plugins/custom-fields-creator/

Viewing 1 replies (of 1 total)
  • I received an email of a follow up but don’t see it here. I used this:

    `<?php $Status = get_post_meta($post->ID, “Status”, true);
    if( !empty($Status) )
    foreach($Status as $Status) {echo $Status [‘status’];} ?>’

    So thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] [Plugin: Custom Fields Creator] Hide if empty’ is closed to new replies.
Skip to toolbar