I've created a "stores" custom post type and on the page I order it by title:
$args = array( 'post_type' => 'store','posts_per_page' => 100, 'orderby' => 'title', 'order' => "ASC" );
I'm using the Types toolset and I've created a field for the admin to add the state in two letter form (CA, NY, TX...). I am trying to modify my loop to not only order by state, but also order by title and I'm not sure how to accomplish that. I looked around and it appears I can make the orderby parameter an array. Below it my code:
$state_code = types_render_field("state-code", array());
$args = array(
'post_type' => 'store',
'posts_per_page' => 100,
'orderby' => array(
$state_code => 'ASC',
'title' => 'ASC',
),
);
Am I able to order it in the following hierarchy?: 1) state code alphabetical order (AK, AL, AR....), then by 2) title