Skip to content

Commit

Permalink
Deal with untranslated term taxonomy archives in the switcher menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwheatley committed Sep 21, 2012
1 parent f274fff commit d87e249
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions class-switcher-menu.php
Expand Up @@ -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';
Expand Down

0 comments on commit d87e249

Please sign in to comment.