I have a site session (WordPress) where I add partners according to the category using Custom Post Type. It's a party hall site. Each category of custom post type represents a branch. Ex of categories: Buffet, Photographers, Etc
So far so good. It's working Ok.
It has a field created as custom field named "wpcf-priority-partner" and I want it to work like this: If equals 0 it sorts partners in normal alphabetical order. If the value is nonzero (from 1 to 9) it has to sort these above the partners listed with 0 and in descending order of priority. 9 over 8, 8 over 7, and so on.
The intention is when a partner pays to stay in evidence he goes to the top of the list according to the priority (from 1 to 9) and those who are set to 0 are in alphabetical order below those that are a priority
Ps .: I'm a designer, I venture into ear PHP. But I have to ask for a HELP.
What I did is list the priorities correctly at the top of the list in descending order from 9 to 1, but those with priority 0 are listed alphabetically in descending order too (Z to A), but I want these are listed alphabetically from A to Z and below the priority.
How to make an 'order' = > 'ASC' sorting by title only for those with the 'wpcf-priority-partner' field listed as 0?
Here's what I did:
<?php
$args=array(
'post_type' => 'parceiros',
'posts_per_page' => 150,
'meta_key' => 'wpcf-prioridade-parceiro',
'orderby' => 'wpcf-prioridade-parceiro',
'order' => 'ASC');
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post();
?>