Polylang and visibility conditions

Hey there!
I’ve been struggling a little bit with Polylang and my templates, and i finally found a good way to work with it.
So i wanted to share with you my solution in a short tutorial (excuse my accent, it’s my first tutorial in english :slight_smile: )

4 Likes

@Louis my tip doesn’t work anymore, have you guys made changes in Cwicly in the last 15 days ?

Hi @pomilo,

Cwicly 1.4.4 was released 25 days ago:

i’ve made my video 15 days ago, i’m pretty sure i was already on cwicly 1.4.4…

i can’t understand why my visibility conditions don’t work anymore, my site is a total mess (and we were about to publish it :sob:)

Big thank you to Dan @StrangeTech who saved me yesterday with a snippet!

So here is the snippet (apply on frontend only):

function get_archive_language() {
$lang = pll_current_language( );
return $lang;
}

and i’ve changed my visibility conditions inside my category archive template only (for the pages, posts, and CPT archive, i keep the “post term” conditions i used in the video).

For the french section:
function return
get_archive_language()
“===”
fr

For the english section:
function return
get_archive_language()
“===”
en

1 Like