Skip to content

Snippet: Show Different Sliders For Polylang

// This is just an example...you will probably want to adjust to also check for the current page or other
// conditionals based on where your slider is located.
function my_polylang_slider( $slider ) {
	if ( function_exists( 'pll_current_language' ) ) {
		$lang = pll_current_language();
		if ( 'es' == $lang ) {
			$slider = '[rev_slider alias="prensa"]';
		} elseif ( 'cat' == $lang ) {
			$slider = '[rev_slider alias="premsa-cat"]';
		}
	}
	return $slider;
}
add_filter( 'wpex_post_slider_shortcode', 'my_polylang_slider' );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top