Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PROVA CERVELLONE STACKEXCHANGE
- // Retrieve all terms for 'tipologia' taxonomy
- $tipologia_terms = get_terms(array(
- 'taxonomy' => 'tipologia',
- 'hide_empty' => false, // Include empty terms as well
- ));
- // Initialize an empty array to store term translations
- $names_trans = array();
- // Iterate over each term and add its translation to the array
- foreach ($tipologia_terms as $term) {
- $names_trans[$term->term_id] = __($term->Apartment, 'sacconicase');
- }
- // Now you have your $names_trans array with translations of tipologia terms
- // Now in your wp_dropdown_categories call, you can use the $names_trans array to translate the terms
- $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,
- 'show_option_all' => esc_html__('Typology', 'sacconicase'),
- 'walker' => new Custom_Taxonomy_Dropdown_Walker($names_trans), // Pass $names_trans to custom walker
- ]);
- //FINE PROVA
Advertisement
Add Comment
Please, Sign In to add comment