Adding an array to my taxonomy search query
-
I’d like to do something similar to what I have done for a taxonomy in a different place
In my search-box function I have this piece
// Retrieve tipologia dropdown $select = $wp_query->get('tipologia'); $select = '' == $select ? 0 : $select; $taxonomy = wp_dropdown_categories([ 'hierarchical' => false, 'name' => 'tipologia', 'taxonomy' => 'tipologia', 'selected' => $select, 'show_option_all' => esc_html__('Typology', 'sacconicase'), 'value_field' => 'slug', 'echo' => false ]);
I’d like to add an array here: ‘taxonomy’ => ‘tipologia’, so that I can gettext all the taxonomy terms like here:
$names_trans = array( 350 => __('Apartment', 'sacconicase'), 354 => __('Apartment in villa', 'sacconicase'), 355 => __('Penthouse', 'sacconicase'), 357 => __('Bungalow', 'sacconicase'), 356 => __('Studio', 'sacconicase'), 367 => __('Villa', 'sacconicase'), 351 => __('Terraced villa', 'sacconicase'), ); $terms = $names_trans[ get_the_terms( $post->ID, 'tipologia')[0]->term_id ];
is it possible?
The page I need help with: [log in to see the link]
- The topic ‘Adding an array to my taxonomy search query’ is closed to new replies.