Support

Account

Home Forums Front-end Issues 1 Custom post type, 2 different meta-values, same loop? Reply To: 1 Custom post type, 2 different meta-values, same loop?

  • Hi @Intrepidrealist

    Thanks for posting the code. Can you please edit your original post and remove any code which is redundant.

    If the problem is that your query is not working, then there is no need to post the loop code as it is confusing to readers.

    Can you please be specific as to what is and isn’t working in your code. Is your original WP_Query working as expected? Does it loop? Does it return posts?

    I have a feeling that your issue lies in the meta_query args you have written.

    You say that you are using a radio field to choose between ‘image’ and ‘video’. Firstly, can you confirm the value saved is ‘Image’ or ‘image’ – this is important.

    Becuase the radio field only saves 1 value, it does not require the LIKE compare – this is only needed for serialized array values such as checkbox.

    So you can change your args to:

    
    'meta_query' => array(
    					'relation' => 'OR',
    					array(
    						'key' => 'slide_media_format',
    						'value' => 'Image',
    					),
    					array(
    						'key' => 'slide_media_format',
    						'value' => 'Video',
    					)
    				)
    

    Hope that helps.

    Thanks
    E