Site logo

[Resolved] Site Identity and WPML

Home Forums Support [Resolved] Site Identity and WPML

Home Forums Support Site Identity and WPML

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #230105
    David

    Hi GP support –

    I have a bilingual website.
    I need to display the logo in Customizer –> Site Identity –> Logo (image) based on the language.
    Is this possible?

    #230141
    Tom
    Lead Developer
    Lead Developer

    Hmm, I think you would need to use GP Hooks and not the logo uploader in the Customizer.

    According to WPML, you can use PHP to see which language is being set.

    For example, you would add this into the Before Header Content hook:

    <?php if ( ICL_LANGUAGE_CODE == 'en' ) { ?>
     
        <img src="URL TO ENGLISH LOGO" alt="" />
     
    <?php } elseif ( ICL_LANGUAGE_CODE == 'ja' ) { ?>
     
        <img src="URL TO JAPANESE LOGO" alt="" />
     
    <?php } else { ?>
        
        <img src="URL TO LOGO IF NO LANGUAGE IS DEFINED" alt="" />
    
    <?php } ?>

    Then make sure you check the “Execute PHP” checkbox.

    I found these definitions here: https://wpml.org/forums/topic/conditional-tags-based-on-which-language-the-page-shows/

    #445646
    Lisa

    HI Tom
    I was connected to this page from WPML support.
    I have added this PHP code in the GP hooks while also removing the logo from the customization tab.
    Both languages are showing both logos. This is the page.
    http://www.p8072-158-1962.s158.upress.link/
    Below is the php code that I have placed.
    How can I fix this?

    <?php
    if(ICL_LANGUAGE_CODE=='he'){ ?>
     
        <img src="http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logoh.jpg" alt="hebrew logo" />
     
    <?php }
    if(ICL_LANGUAGE_CODE=='en'){ ?>
     
        <img src="http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logo-en.jpg" alt="english logo" />
     
    <?php }} ?>
    #445681
    Leo
    Staff
    Customer Support

    Can you try the elseif way as Tom suggested?

    #446707
    Lisa

    ok… yes this works now..
    https://prnt.sc/hlx6nw
    how do I get the logo to sit left of the header.
    http://www.p8072-158-1962.s158.upress.link/en/

    as the primary logo sits right in the primary language
    https://prnt.sc/hlx7nn

    #446982
    Leo
    Staff
    Customer Support

    Looks like you are wanting to use this layout here: https://docs.generatepress.com/article/navigation-logo/#navigation-as-header

    #449170
    Lisa

    HI Leo
    Thanks for your help… but I think that you are sending me in the wrong directions to fix this… and could mess up the header completely.

    1. My primary language banner is good/working – see screen capture. https://prnt.sc/hlx7nn
    2. The secondary language in English – the banner is 90% ok… what needs fixing is the alignment left of the logo
    what it looks like now.. https://prnt.sc/hlx6nw > this is what I need it to look like.. https://prnt.sc/hnbkl7

    Hoping this is clearer.

    thanks
    Lisa

    #449443
    Leo
    Staff
    Customer Support

    Can you try this CSS:

    .header-aligned-right:not(.rtl) .site-header {
        text-align: left;
    }

    Let us know.

    #449948
    Lisa

    great…. that did the job.
    Thanks

    #450299
    Leo
    Staff
    Customer Support

    No problem!

    #451900
    Lisa

    Hi Leo
    so I still a few issues re. the logo.

    I now see that I don’t have a logo on the sticky menu for English site
    https://prnt.sc/hoz2xt

    and on the mobile menu, the logo in English is missing, I get the alt text
    https://prnt.sc/hoz44h

    HOw do I add these?

    Link to site
    http://www.p8072-158-1962.s158.upress.link/en/

    #452052
    Leo
    Staff
    Customer Support

    I can see the logo fine on desktop: https://s33.postimg.org/aixfycre7/2017-12-18_0531.png

    For mobile, the mobile header logo you’ve uploaded isn’t valid: http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logo-en.jpg

    Try re-uploading.

    #452101
    Lisa

    HI Leo
    I will explain again…
    The sticky menu is missing the logo in english lan (secondary language) SEE SCREEN SHOT – https://prnt.sc/hoz2xt
    ON the mobile site the English Lan is missing the logo to – SEE SCREEN SHOT – https://prnt.sc/hoz44h

    Lisa

    #452168
    Leo
    Staff
    Customer Support

    Your navigation english navigation logo address isn’t valid: http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logo-en.jpg

    The same image is also used in navigation logo which is also not valid.

    #452686
    Lisa

    OK . I understand…. so I’m getting closer.
    sticky menu English lan in now ok on desktop 🙂

    the English menu now appears on the mobile site BUT it has also overridden the primary language logo in the hebrew site…i.e. both languages have English logo on mobile site.

    Lisa

    p.s so sorry to have all these issues 🙁

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.