Qtranslate, taxonomy drop down problems
-
Hello,
I’m creating a webpage for two languages and use qtranslate for the translation part.
I have now got stuck on my front end drop down that I have created for my custom_post_type taxonomy.
It works fine for my default language (Swedish) but on my secondary language (English) when I choose a city in my drop down the url doesn’t get correct and I just end up on the start/home page.
English that doesn’t work: http://780824.se/wordpress/sthal/en/retailers-in-england/
Swedish that work: http://780824.se/wordpress/sthal/aterforsaljare-i-sverige/My code to create the taxonomy (functions.php)
function my_taxonomies_retailer() { $labels = array( 'name' => _x( 'Retailer Categories', 'taxonomy general name' ), 'singular_name' => _x( 'Retailer Category', 'taxonomy singular name' ), 'search_items' => __( 'Search Retailer Categories' ), 'all_items' => __( 'All Retailer Categories' ), 'parent_item' => __( 'Parent Retailer Category' ), 'parent_item_colon' => __( 'Parent Retailer Category:' ), 'edit_item' => __( 'Edit Retailer Category' ), 'update_item' => __( 'Update Retailer Category' ), 'add_new_item' => __( 'Add New Retailer Category' ), 'new_item_name' => __( 'New Retailer Category' ), 'menu_name' => __( 'Retailer Categories' ), ); $args = array( 'labels' => $labels, 'rewrite' => array( 'slug' => 'retailers', 'hierarchical'=>true ), 'hierarchical' => true, ); register_taxonomy( 'retailer_category', 'retailer', $args ); } add_action( 'init', 'my_taxonomies_retailer', 0 );
My code to create the drop down (functions.php)
function get_terms_dropdown($taxonomies, $args){ $myterms = get_terms($taxonomies, $args); $output ="<select name='retailer_category'>"; $output .="<option value='#'>Select</option>"; foreach($myterms as $term){ $root_url = get_bloginfo('url'); $term_taxonomy=$term->taxonomy; $term_slug=$term->slug; $term_name =$term->name; /* $term_count=$term->count; (".$term->count.")*/ $link = $term_slug; $output .="<option value='".$link."'>".$term_name."</option>"; } $output .="</select>"; return $output; }
Code in my page-template to show the drop down.
<?php if(is_page('1494') ): ?> <form action="<?php bloginfo('url'); ?>" method="get"> <?php $taxonomies = array('retailer_category'); $args = array('child_of'=>'8','orderby'=>'name'); $select = get_terms_dropdown($taxonomies, $args); $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select); echo $select; ?> <noscript><div><input type="submit" value="Go" /></div></noscript> </form>
Anyone that have a clue on how to solve this?
- The topic ‘Qtranslate, taxonomy drop down problems’ is closed to new replies.