WordPress.org

Forums

how to find home page id for different language page (9 posts)

  1. antorera
    Member
    Posted 4 years ago #

    Hello,

    I have a multilingual site I'm working on in WPML. I want to prevent some widgets from appearing on the Spanish version of the site. I am using WidgetLogic to do this and I am able to specify the pages to exclude. However, I can't figure out the conditional statement to exclude the home page for the Spanish site.

    I have the Spanish site set up as http://www.example.com/?lang=es

    The conditional tag I'm using for the other pages is:
    !is_page(array(229,249,254,256,259,262,265,281,292))

    I can't use !is_home() because that will exclude the English home page.

    Any help would be greatly appreciated!

  2. alanft
    Member
    Posted 4 years ago #

    try

    $_GET['lang']=='es'

  3. antorera
    Member
    Posted 4 years ago #

    I was looking for something like this. Now how do I use it to exclude the spanish version being used? Or is the "$_" part what excludes it?

  4. alanft
    Member
    Posted 4 years ago #

    to make a widget appear when the URL has ?lang=esm use the above, to make a widget vanish when that's the case use

    $_GET['lang']!='es'

  5. Phil Meyer
    Member
    Posted 4 years ago #

    I was just looking for this... thanks!

  6. alless
    Member
    Posted 4 years ago #

    This one is mybe better

    ( ICL_LANGUAGE_CODE == 'en' )

  7. waterstones
    Member
    Posted 4 years ago #

    Dealing with the same issue and tried the above suggestions. Not sure if I've used the correct syntax as neither of the following does anything. Ideas?

    is_home($_GET['lang']!='es')
    is_front_page($_GET['lang']!='es')

    In Settings > Reading The front page is set to the latest posts.
    Using WPML for translation.

  8. alanft
    Member
    Posted 4 years ago #

    try

    is_home() && (ICL_LANGUAGE_CODE == 'en' )

    for the home page in english

  9. waterstones
    Member
    Posted 4 years ago #

    Thank you for that, Alan.

    What I ended up with was this for the English side:

    is_home() | is_page() && (ICL_LANGUAGE_CODE == 'en' )

    And this for the Spanish side:

    is_home() | is_page() && (ICL_LANGUAGE_CODE == 'es' )

    John

Topic Closed

This topic has been closed to new replies.

About this Topic