Insert Template into archive-product.php
-
I use
echo do_shortcode(‘ [elementor-template id=”24938″] ‘);
to insert custom templates into say: my product archive. Which works great, but im now eager to start using Polylang and I can’t figure out how to make it show the right template for the right language.
Template A – English only
Template B – Dutch onlyAnyone know the right trigger to let the site figure out when to show which template?
I’ve already tried something with
// [polylang lang=”en”]English[/polylang][polylang lang=”de”]Deutsch[/polylang]
//Add this code in your functions.php
function polylang_shortcode($atts, $content = null)
{
if (empty($content))
return ”;
extract( shortcode_atts( array(‘lang’ => ”), $atts ) );
if (empty($lang))
return “### You must specify ‘lang’ using shortcode: polylang”;
return ($lang == pll_current_language()) ? $content : ”;
}
add_shortcode(‘polylang’, ‘polylang_shortcode’);But I can’t figure out how to make it show the elementor template when the page is viewed in a certain language.
- The topic ‘Insert Template into archive-product.php’ is closed to new replies.