You can use polylang function pll_current_language() to get the current language.
Hello thanks so much I’ll check this.
Let you know if I still struggled once I’ve tried the code π
Enjoy your day!! and thanks again
Hello I’m very very lost. I’m not so good in HTML, sorry…
What I want is to put a different Revolution Slider for my FR and EN subdomains. (You can see my blog is plumedaure.com).
—-
For now I just have <?php putRevSlider(“Plumedaure”) ?> which is a French Slider on index.php but the problem is I want to call a different one for english (called : <?php putRevSlider(“Plumedaureenglish”) ?> )
What is the code I have to use please? This is my index.php code below :
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
<?php get_header(); ?>
<?php putRevSlider("Plumedaure") ?>
<div class="row">
<div class="col-md-8">
<main id="content" class="entries-classic" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
<div class="row">
<div class="col-md-12">
<?php if( is_search() ): ?>
<?php
global $wp_query;
$found = $wp_query->found_posts;
$none = esc_html__( 'No results found. Please broaden your terms and search again.', 'olsen-light' );
$one = esc_html__( 'Just one result found. We either nailed it, or you might want to broaden your terms and search again.', 'olsen-light' );
$many = esc_html( sprintf( _n( '%d result found.', '%d results found.', $found, 'olsen-light' ), $found ) );
?>
<article class="entry">
<h2 class="entry-title">
<?php esc_html_e( 'Search results' , 'olsen-light' ); ?>
</h2>
<div class="entry-content" itemprop="text">
<p><?php olsen_light_e_inflect( $found, $none, $one, $many ); ?></p>
<?php if ( $found < 2 ) {
get_search_form();
} ?>
</div>
<div class="entry-utils group"></div>
</article>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'entry' ); ?>
<?php endwhile; ?>
</div>
</div>
<?php olsen_light_pagination(); ?>
</main>
</div>
<div class="col-md-4">
<?php get_sidebar(); ?>
</div>
</div><!-- /row -->
<?php get_footer(); ?>
—–
If you could help you would be my HERO of all times ! Thanks so much
ok, try this
<?php
get_header();
$curlang = pll_current_language();
if ($curlang=='en') {
putRevSlider("Plumedaureenglish");
}
elseif ($curlang=='fr') {
putRevSlider("Plumedaure");
}
else { //slider for other languages, default to french
putRevSlider("Plumedaure");
}
?>
the rest of the code is the same. Try this and tell me how is it going.
Cheers…
OH MY GOD you are a STAR ! Thanks sooo much ! It works ! You can check it by yourself π
Plumedaure.com
Super happy ! Any review I can let somewhere for you? π
Hi…it is good to hear that it works for you. I see your blog and a nice one too.
Cheers…
Hey!
This topic might be dead, but I am currently experiencing some flaws here.
I am trying to create the code as following (explained newbie style)
if curlang = 1 { do_shortcode ([myshortcode1]) } ifelse curlang = 2 { do_shortcode ([myshortcode2]) }
Im not an expert in PHP, so I can’t create my own code.
I’ve used code above, resulting in a blank page.
I’m using insert pages plugin to implement pages into the main-page (since my customers can then edit the page them self).
Code:
<?php $curlang = pll_current_language();
if ($curlang=='nl') {
do_shortcode( "[insert page='welkom' display='content']" );
}
elseif ($curlang=='de') {
do_shortcode( "[insert page='wilkommen' display='content']" );
}
else { //If language is different then NL or DE
do_shortcode("[insert page='welkom' display='content']");
}
?>
Can you help/explain why its not working for me?
Page is wp.energizedesigns.nl
Thanks