Show multiple tax_query from 2 or more post_type in a single code
Answering myself, the problem was the ‘AND’, must be ‘OR’, thank you anyway.
Answering myself, the problem was the ‘AND’, must be ‘OR’, thank you anyway.
When you register the taxonomies you can specify multiple post types: function register_my_taxonomies() { register_taxonomy( ‘location’, array(‘post’,’page’, ‘adverts’, ‘businesses’),
It working now this is the right template with the code i should use Thanks for help <?php /** * Archive Template * * Displays an Archive index of post-type items. Other more specific archive templates * may override the display of this template for example the category.php. * * @package Thematic * @subpackage Templates … Read more
I figured it out I just have to add another argument and then it was working fine: $myterms = get_terms( ‘iqvis_event_category’, array( ‘parent’ => 0, ‘hide_empty’ => 0 ) ); echo ‘<pre>’; print_r($myterms); echo ‘</pre>’;
Try this: within $args, leave ‘taxonomy’ where it is and put the remaining three arguments in a ‘term_args’ sub-array. Based on the documentation, it appears that the filter passes arguments to get_terms() through a ‘term_args’ sub-array. Your $args array is mixing filter arguments and get_terms() arguments at the same level, and it looks like that … Read more
You changed the checkbox’s name attribute value. You should use the same name value: terms[$taxonomy][] This should fix the code: if (is_taxonomy_hierarchical($taxonomy)) //$out .= “<input class=”{$term->term_taxonomy_id}” type=”checkbox” value=”{$term->term_taxonomy_id}” name=”{$term->term_taxonomy_id}” /> {$term->name}<br />”; $out .= “<input class=”{$term->term_taxonomy_id}” type=”checkbox” value=”{$term->term_taxonomy_id}” name=”terms[{$taxonomy}][]” /> {$term->name}<br />”; else // $out .= “<input class=”{$term->term_taxonomy_id}” type=”checkbox” value=”{$term->name}” name=”{$term->name}” /> {$term->name}”; $out .= … Read more
Use get_terms() with child_of (accepts numerical ID of parent term) argument to retrieve child terms and then loop through them and on each iteration use current term in the loop. Code example (not tested): $child_terms = get_terms( array( ‘child_of’ => $cameras_term_id ) ); foreach( $child_terms as $term ) { $args = array( ‘post_type’=> ‘rental_gear’, ‘type’ … Read more
The third argument of add_action is the priority, or order in which functions hooked to an action will be executed. from add_action in codex: (optional) Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed … Read more
You can register taxonomies for objects (such as posts & pages) like so: add_action( ‘init’, ‘wpse_71914_assign_page_taxonomy’ ); function wpse_71914_assign_page_taxonomy() { register_taxonomy_for_object_type( ‘taxonomy_name’, ‘page’ ); }
not the best way (at least if you have a lot of tags) add_filter(‘get_terms_orderby’, ‘get_terms_orderby_natural_slug’,10,2); wp_dropdown_categories( ‘taxonomy=week&hierarchical=1&orderby=slug’ ); remove_filter(‘get_terms_orderby’, ‘get_terms_orderby_natural_slug’); function get_terms_orderby_natural_slug($orderby, $args){ $orderby = “SUBSTR({$orderby} FROM 1 FOR 5), CAST(SUBSTR({$orderby} FROM 6) AS UNSIGNED), SUBSTR({$orderby} FROM 6)”; return $orderby; } but still this is a way to do that…