• Resolved furkanozkaya

    (@furkanozkaya)


    I’m trying to show different codes for different languages on the gtranslate WordPress plugin.

    Here is what I’m trying to do:

    <figure>
                                    <?php
                                    $current_lang_code = $_SERVER['HTTP_X_GT_LANG'];
                                    if ($current_lang_code === 'ru') { ?>
                                    <img class="img-fit" src="https://www.mgc.com.tr/wp-content/uploads/2022/10/mgc-slider-rusca-v1-sks.jpg" alt="İstanbul Hukuk Bürosu">
                                    <?php } else if ($current_lang_code === 'ar') { ?>
                                    <img class="img-fit" src="https://www.mgc.com.tr/wp-content/uploads/2022/10/mgc-slider-arapca-v1-sks.jpg" alt="İstanbul Hukuk Bürosu">
                                    <?php } else { echo do_shortcode('[metaslider id="6449"]'); } ?>
                                </figure>

    So the idea is that I’m going to show my slider on my Turkish original website and show the other two images on the translated versions, which are automatically translated by gtranslate plugin. It seems to work but sometimes it gets cached or shows the wrong image (for example, Russian image when you are on the Arabic page, etc.). How can I make this work properly?

    I don’t have any active cache plugin right now, but I will activate in the future of course.

    Thank you, regards.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Change Code on Different Languages’ is closed to new replies.