Grow your CSS skills. Land your dream job.

Display metaData except for “Price” or “Download”

  • # April 19, 2013 at 10:06 am

    How do I make a for-loop that will display all the metaData except for what has a name of “Price” or the name “Download”

    Right now I’m using < ?php the_meta(); ?> which just shows everything.

    # April 19, 2013 at 10:46 am

    This look shows everything with the label Downloads. Now how can I switch this around to show everything except for download along with the name of the Value as the label….?

    < ?php
    //Get any custom field data under the name Downloads and display
    $downloadField = get_post_meta($post->ID, ‘Downloads’, true);
    if ($downloadField) {
    $custom_fields = get_post_meta( get_the_ID() );
    $my_custom_field = $custom_fields;
    foreach ( $my_custom_field as $key => $value )
    echo “

    ” . $value . “

    ” ;
    }
    else {
    }
    ?>

    # April 19, 2013 at 2:50 pm

    check the key of the meta data and continue the loop like

    if($key == ‘Download’ || $key == ‘Price’){continue;}

    first line in your foreach loop

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".