I take it the actual property you want to list is a post of some type, to which various taxonomy terms are assigned. Unless these properties are actually “post” post type, you’ll need to specify that in your query. That and getting only posts with a particular taxonomy term is possible with WP_Query. Where you run into trouble is ordering the found posts by taxonomy term name. There is no such orderby argument accepted by WP_Query. You essentially need to write and use your own SQL query.
You would then use $wpdb methods to execute your query. You can then loop through the results and generate output much like the usual WP loop. But there is one big caveat. The standard WP loop relies on WP_Query methods like have_posts() and the_post(). These are not available when you use $wpdb methods. Furthermore, template tags like the_permalink(), the_title(), etc. will not work in your loop unless you specifically prepare the current post object with setup_postdata().
OK, it looks like you want to query for the “tipo_hotel” post type. That’s fine. What I said previously still holds true, you cannot order tipo_hotel posts by taxonomy term names with WP_Query. You would need to compose a SQL query to get posts ordered by term name.
The other thing you could do is use WP_Query to get the posts, then use PHP’s usort() to arrange the returned posts in desired order. Depending on how this is done, it can be anywhere from inefficient to extremely inefficient. Using SQL would be much better.
Thanks bcworks. Maybe I need some help with this query in wordpress (I usually do SQL querys outside WordPress, but I’m not very familiar with querys with taxonomies and pods).
Understandable. The taxonomy/term/object relationship is a bit convoluted. I’ve struggled with this as well. I can offer what I ended up with. You will need to adapt it to your specific situation. At least it gives you a good head start.
//list all posts & portfolios w/ categories ordered by category name
global $wpdb;
$query = $wpdb->get_results( "SELECT * FROM $wpdb->posts AS p
LEFT JOIN $wpdb->term_relationships AS r ON (p.ID = r.object_id)
INNER JOIN $wpdb->term_taxonomy AS x ON (r.term_taxonomy_id = x.term_taxonomy_id)
INNER JOIN $wpdb->terms AS t ON (r.term_taxonomy_id = t.term_id)
WHERE p.post_type IN ('post', 'portfolio')
AND p.post_status = 'publish'
AND x.taxonomy = 'category'
ORDER BY t.name ASC, p.post_date DESC;"
);