Polylang Huge IT Slider
-
Hello Everyone!
I’m using Polylang alongside with Huge IT Slider and I found out that Huge IT Slider is not supported by Polylang (I can’t translate my sliders) but I managed to solve this by doing separate sliders for separate languages.
I’ve read on the documentation that there is a function called “pll_current_language” which returns the actually set language and I think I can use this to determine the selected language and display the slider for the selected language.
Now my question is the following: How can I use this function alongside with PHP elseif/else if?
My two language is Hungarian and Slovak and I’m using the Twenty Sixteen theme.
So I want to do the following check on the header:
If the language is set to hungarian <?php echo do_shortcode("[huge_it_slider id='1']"); ?> If the language is set to slovak <?php echo do_shortcode("[huge_it_slider id='2']"); ?>
How can I use this check?
Thank you for your time and help!
-
Hello everyone!
It’s me again.
I’ve managed to solve it with the following code:
<?php $currentlang = get_bloginfo('language'); if($currentlang=="hu-HU"): ?> <?php echo do_shortcode("[huge_it_slider id='1']"); ?><br /> <?php else: ?> <?php echo do_shortcode("[huge_it_slider id='2']"); ?><br /> <?php endif; ?>
For beginners like me to spare some hours of search a little (noob) explanation:
This part does the first language check:
<?php $currentlang = get_bloginfo('language'); if($currentlang=="hu-HU"): ?>
This part shows the hungarian slider if the above statement is true:
<?php echo do_shortcode("[huge_it_slider id='1']"); ?><br />
This part moves on to the next operation (if the statement in the previous case is NOT true):
<?php else: ?>
This part shows the slovak slider:
<?php echo do_shortcode("[huge_it_slider id='2']"); ?><br />
And this part closes the whole operation:
<?php endif; ?>
I think this is a pretty easy solution for 2 languages. Maybe with more languages you need to create more “if” sections.
So problem solved, thank you for the documentation of Polylang and WordPress.
This thread can be closed.
- The topic ‘Polylang Huge IT Slider’ is closed to new replies.