• Hi, is it possible to ONLY translate the logo (by swapping out the image, which works) but touch nothing else on the site?

    We have another plugin handling the translation so Translate press is messing that up. Could not find any option to disable automatic translation. Please advise.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m not from support, but if you know where to find the placement of the image in php, you could use

    if (get_locale() == 'nl_NL') { echo ''; }
    elseif (get_locale() == 'fr_FR') { echo ''; }
    elseif...

    And echo the element you want for that language.

    For example if you have
    <img src="imgLogo.jpg">
    for nl_NL and you want to swap it to imgLogo2.jpg for fr_FR, you can apply this

    if (get_locale() == 'nl_NL') { echo '<img src="imgLogo.jpg">'; }
    elseif (get_locale() == 'fr_FR') { echo '<img src="imgLogo2.jpg">'; }

    get_locale() is a function WordPress uses to check which language is viewed.
    This does not require TranslatePress, just the use of WordPress, so you won’t have TranslatePress messing something up.

    • This reply was modified 4 years, 5 months ago by tlouwet. Reason: changed 'return' to 'echo'
    Thread Starter mjoundi

    (@mjoundi)

    Thank you very much for the response. Does this involve editing the functions.php file?

    I did not want to mess with any template files, and I currently do not have access. Which is why I was hoping a plugin could take care of this task. Translatepress does work, but I’d like to somehow disable it from doing anything else.

    My reply was a template-only solution, no need for functions.php editing.

    For example if it’s an image in the header you wanted to change, you edit it in the header.php (obviously depends on what plugins you’re using).

    If you can’t edit the template, but you are able to exchange the image with a shortcode, you could reach a solution that way.

    function exchange_image_function() {
    if (get_locale() == 'nl_NL') { echo '<img src="imgLogo.jpg">'; }
    elseif (get_locale() == 'fr_FR') { echo '<img src="imgLogo2.jpg">'; }
    }
    add_shortcode('exchangeImage', 'exchange_image_function');
    

    in functions.php
    src=”imgLogo.jpg” ofcourse needs to be the url to the image.

    Above will be called with [exchangeImage].

    If you can’t add a shortcode instead of the logo, sadly that’s the limit of my php knowledge.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translate logo ONLY’ is closed to new replies.