• Resolved aptharsia

    (@aptharsia)


    <?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)
  • Thread Starter aptharsia

    (@aptharsia)

    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 ‘[Plugin: Custom Fields Creator] Hide if empty’ is closed to new replies.