Displaying Multiple Post types in Taxonomy

Hook into pre_get_posts, check for the taxonomy, and set all four post types as the post_type parameter of the query object. Check out the Type Parameters section on the WP_Query docs for more information. <?php add_action(‘pre_get_posts’, ‘wpse87225_set_post_types’); function wpse87225_set_post_types($query) { if (is_admin() || !$query->is_main_query() || !is_tax(‘destination’)) { return; // bail, not where we want to … Read more

get_term_children returns WP_Error for custom taxonomy

Since get_term_link() will return a WP_Error object if the term does not exist, you could try: $termchildren = get_term_children( $taxID, $taxType ); echo ‘<ul>’; foreach ( $termchildren as $child ) { $term = get_term_by( ‘id’, $child, $taxType ); $term_link = get_term_link( $term->name, $taxType ); if( ! is_wp_error( $term_link ) ) echo ‘<li><a href=”‘ . $term_link … Read more

Custom taxonomy template for multiple custom post types

When you land in a taxonomy archive page, e.g. the one with url http://yoursite.com/city/london/ WordPress can’t know if you want to see London’s Hotels, Gym of Supermarkets: you have to inform it. How inform WordPress? By url. So, if your url appear like http://yoursite.com/city/london/show/gym now WordPress understand you want to see only gyms… How to … Read more