• Some of the values in my Custom Fields have keys built-in to them, such as:

    field name: audiofile
    value: 001;music01.mp3
    value: 002;music02.mp3

    Others might not have that key:

    field name: audiofile
    value: music.mp3

    Is there a way to query the Custom Field and, if it contains the semi-colon, setup to display multiple audio files. If it doesn’t contain the semi-colon, just display the one audio file.

    I’m just trying to figure out how to setup the select query so that, for example:

    IF ($audiofile CONTAINS “;”) { //do this } else { //do this other thing }

    I’m just not sure how to phrase it. Any help would be appreciated.

Viewing 1 replies (of 1 total)
  • Can you do what you want by setting the third parameter to get_post_meta() to ‘false’ and checking to see if multiple meta values are returned?

    <?php $meta_values = get_post_meta( $post_id, $key, $single=false ); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Check to see if Custom Field contains a certain charcter’ is closed to new replies.