Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Display metaData except for “Price” or “Download”

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44245
    JokerMartini
    Participant

    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 which just shows everything.

    #132440
    JokerMartini
    Participant

    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….?

    //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 {
    }
    ?>

    #132459
    pixelgrid
    Participant

    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)
  • The forum ‘CSS’ is closed to new topics and replies.