langbar
// Add Shortcode
function custom_shortcode( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
),
$atts
);
function custom_polylang_langswitcher() {
$output = '';
if ( function_exists( 'pll_the_languages' ) ) {
$args = [
'show_flags' => 0,
'show_names' => 1,
'echo' => 0,
];
$output = '<ul class="polylang_langswitcher">'.pll_the_languages( $args ). '</ul>';
}
return $output;
}
add_shortcode( 'polylang_langswitcher', 'custom_polylang_langswitcher' );
}
add_shortcode( '[langbar]', 'custom_shortcode' );