Support » Fixing WordPress » How to detect more then one value into a meta key?

  • Hi,

    I would like to know if it is possible to detect differents values from the same Meta Key into a query_post.

    I have a page that shows promotions depending on the values of the meta values.

    I got 2 types of products
    1. Clothes
    2. Shoes

    I want to get 3 types of possible promotions
    1. Both
    2. Clothes
    3. Shoes

    So if we follow this, I would like to show the promotion “X” in shoes and clothes if my meta value is “Both” only show the promotion “X” in shoes if in the same key I use “Shoes”.

    Not sure if this is well explain.

    Here a part of code.

    $args = array(
    'post_type'	=> 'post',
    'meta_key'	=> 'concours_ou_promotion',
    'meta_value'	=> 'promotion',
    'meta_key'	=> 'Type de promotion',
    'meta_value'	=> 'Les deux',
    'meta_key'	=> 'Type de promotion',
    'meta_value'	=> 'VĂȘtements',
    'orderby'	=> 'ID',
    'order'		=> 'ASC',
    'numberposts'	=> 5
    );

    You can see that I have tried to place the “Type de promotion” twice, but this is not working because the script search if it is in “Les deux” and in “VĂȘtements”.

    I would like to detect if it is one or an other.

    Any help would be appreciate.

Viewing 1 replies (of 1 total)
  • I didn’t find a solution yet…

    So I have made the “easy way” by adding the custom field twice.

    Any help would be great to make the code better.

Viewing 1 replies (of 1 total)
  • The topic ‘How to detect more then one value into a meta key?’ is closed to new replies.