Skip to content

Instantly share code, notes, and snippets.

@crumina
Created September 11, 2015 09:45
Show Gist options
  • Save crumina/c1e515aecd3dce31c32c to your computer and use it in GitHub Desktop.
Save crumina/c1e515aecd3dce31c32c to your computer and use it in GitHub Desktop.
[Embrace] WPML - default language switcher
if ( ! function_exists( 'reactor_toplang_r' ) ) {
function reactor_toplang_r( $args = '' ) {
if ( function_exists( 'icl_get_languages' ) ) {
$defaults = array(
'side' => 'right',
);
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'reactor_top_bar_args', $args );
$output = '<div class="' . $args['side'] . '">' . do_action('wpml_add_language_selector') . '</div>';
}
return apply_filters( 'reactor_toplang_r', $output );
}
}
if ( ! function_exists( 'reactor_toplang_l' ) ) {
function reactor_toplang_l( $args = '' ) {
if ( function_exists( 'icl_get_languages' ) ) {
$defaults = array(
'side' => 'left',
);
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'reactor_top_bar_args', $args );
$output = '<div class="' . $args['side'] . '">' . do_action('wpml_add_language_selector') . '</div>';
return apply_filters( 'reactor_toplang_l', $output );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment