Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter AndruC

    (@andruc)

    To clarify, the post to be displayed requires both that its mpl_highlighted field has a value of 1, AND that the user’s location exists as a value of either country, state, or city.

    Thread Starter AndruC

    (@andruc)

    The problem is that the second meta array’s value, location, could be associated with one of three different keys. Would that be written then, like this?

    query_posts( array('post_type' => POST_TYPE,
      TAX_CAT => $term->slug,
      'ignore_sticky_posts' => 1,
      'posts_per_page' => 3,
      'meta_query' => array (
        'compare' => '=',
        'relation' => 'AND',
        array ( 'key' => 'mpl_highlighted',
    	    'value' => 1),
        array ( 'compare' => 'how compare',
                'relation' => 'OR',
          array ( 'key' => 'country',
                  'value' => $userlocation ),
          array ( 'key' => 'state',
                  'value' => $userlocation ),
          array ( 'key' => 'state',
                  'value' => $userlocation ) ),
        'orderby' => 'rand' ) );

    I’ve noticed the problem, but I’ve only attempted it with a custom post type. Unfortunately, it’s going to be a major problem to fix manually.

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