• Is it possible to select the first item in an array like below to sortby? I am need to sort by application type, but needing to sort it by just the first item in the array. Below is what I am using and hopefully something like it would? Hope I’m making sense. Really would appreciate the help!

    $args = array(
    // ‘relation’ => ‘AND’,
    ‘cat’ => 5,
    ‘post_type’ => ‘post’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘floor_type’,
    ‘value’ => $floor_type
    ),
    array(
    ‘key’ => ‘stack_type’,
    ‘value’ => $stack_type
    ),
    array(
    ‘key’ => ‘plumbing_opening’,
    ‘value’ => $plumbing_opening
    )),
    ‘meta_key’ => ‘application_type’,
    ‘orderby’ => reset($meta_value),
    ‘order’ => ‘ASC’
    );
    $posts = query_posts($args);

  • The topic ‘need to select first item in meta_value array to sortby’ is closed to new replies.