From d87e24912717e849c77e0b93ffde7120a448c8f2 Mon Sep 17 00:00:00 2001 From: Simon Wheatley Date: Fri, 21 Sep 2012 11:13:06 +0100 Subject: [PATCH] Deal with untranslated term taxonomy archives in the switcher menu. --- class-switcher-menu.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/class-switcher-menu.php b/class-switcher-menu.php index 5b9c336..b4633c6 100644 --- a/class-switcher-menu.php +++ b/class-switcher-menu.php @@ -462,9 +462,13 @@ protected function add_post_type_archive_link( $lang ) { **/ protected function add_taxonomy_archive_link( $lang ) { $classes = array(); - if ( isset( $this->translations[ $lang->code ]->term_id ) ) { // Translation exists + $queried_object = get_queried_object(); + if ( ! bbl_is_translated_taxonomy( $queried_object->taxonomy ) ) { + $this->add_arbitrary_link( $lang ); + return; + } elseif ( isset( $this->translations[ $lang->code ]->term_id ) ) { // Translation exists bbl_switch_to_lang( $lang->code ); - $href = get_term_link( $this->translations[ $lang->code ], bbl_get_base_taxonomy( $this->translations[ $lang->code ]->taxonomy ) ); + $href = get_term_link( $this->translations[ $lang->code ], bbl_get_base_taxonomy( $queried_object->taxonomy ) ); bbl_restore_lang(); $title = sprintf( __( 'Switch to %s', 'bbl' ), $lang->names ); $classes[] = 'bbl-existing';