Hi Victoire,
Yes, this is definitely possible but will require a few lines of code. Are you using WPML? In that case, the following example code should do what you want.
In box settings:
Load this box if … everywhere
In your theme its functions.php file:
// load box "100" when viewing English site
add_filter( 'boxzilla_load_box_100', function() {
return ICL_LANGUAGE_CODE == 'en';
});
// load box "105" when viewing German site
add_filter( 'boxzilla_load_box_105', function() {
return ICL_LANGUAGE_CODE == 'de';
});
Hope that helps. If not, let me know!
Hello Danny! Thank you so much for your help. I’m actually using Polylang, would you have something for that?
My two languages are English and French.
Merci!!
Hi Victoire,
With Polylang, the following should work!
// load box "100" when viewing English site
add_filter( 'boxzilla_load_box_100', function() {
return pll_current_language() == 'en';
});
// repeat for other languages and box ID's.
PS. Should you have a quick minute to spare, a plugin review here on ww.wp.xz.cn would make us quite happy. 🙂
Hey Danny, I added that to the custom CSS section but it’s still not working, could you let me know how to proceed? Thank you a million times!
I get a lot of error messages when I’m adding this to my custom CSS, would you like access to my back office? Thank you!!
-
This reply was modified 9 years, 6 months ago by
victoireloup. Reason: more details
@dvankooten
This thread is also relevant to me….
what are the numbers 100 and 105 represent in the code ?
// load box "100" when viewing English site
add_filter( 'boxzilla_load_box_100', function() {
return ICL_LANGUAGE_CODE == 'en';
});
// load box "105" when viewing German site
add_filter( 'boxzilla_load_box_105', function() {
return ICL_LANGUAGE_CODE == 'de';
});
can i use this function as it is with only adjusting the ICL_LANGUAGE_CODE to all the boxes defined ?
@dvankooten
never mind… i figured it myself…. it’s the Box ID
works smoothly
thanks!
is there a way to do this for every box with out having to use the ID.
I’d like it to apply to each box we create coz my site is completely bilingual