Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #300547

    Hi Im tryin to add google translation to enfold (opposite logo)

    1. where do I add

    <meta name=”google-translate-customization” content=”XXXXXX”></meta>

    2. What ” do I need to escape on ‘ below when I add to function-set-avia-frontend.php around line 439?

    <div id=”google_translate_element”></div><script type=”text/javascript”>
    function googleTranslateElementInit() {
    new google.translate.TranslateElement({pageLanguage: ‘en’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, ‘google_translate_element’);
    }
    </script><script type=”text/javascript” src=”//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit”></script>

    #301117

    Hi bensmithdesign!

    Thank you for using the theme

    Please add this on functions.php:

    function add_google_translate() { ?>
    <meta name="google-translate-customization" content="XXXXXX"></meta>
    <?php
    }
    
    add_action('wp_head', 'add_google_translate');
    
    function add_google_translate_script() { ?>
    <div id="google_translate_element"></div>
    <script type="text/javascript">
    function googleTranslateElementInit() {
    new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
    }
    </script>
    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <?php
    }
    
    add_action('ava_after_main_menu', 'add_google_translate_script'); 

    This will add the translator right after the main menu.

    Cheers!
    Ismael

    #301158

    thank you thanks great, how do I put it right of the logo not the menu?

    #301220

    Hi!

    You can probably use css to change the position – please post a link to your website and we’ll see if we can provide some code to change the position.

    Regards,
    Peter

    #301248

    thanks dude, afraid its local.

    I need it outside the nave menu ideally in

    #header_main
    or

    .container

    ?

    #301428

    Hey!

    Try using this code:

    #google_translate_element{
    position: absolute;
    top: 0;
    right: 120px;
    }

    Modify the top/right values until you get the desired result.

    Regards,
    Josue

    #301485

    Thanks it does move but the plugin isnt clickable when the position is moved?

    #301486

    Hi!

    Maybe you need to increase its z-index value:

    #google_translate_element{
    z-index:1000;
    }

    Best regards,
    Josue

    #301487

    Sorry tried that, its when I add

    top: -40px

    #301713

    Hi,

    Please make the site live then reply back to this topic so we can assist you better.

    Regards,
    Josue

    #301822

    Sorry I need to show client it working first, again its

    How do I create a new marker position like ‘add_action(‘ava_after_main_menu’)

    and add in it position
    function-set-avia-frontend.php around line 439

    Thanks for your time.

    #301828

    Hey!

    There is already a hook (avf_logo_final_output) you can use to append something to the logo, try:

    function add_google_translate_script($logo, $use_image, $headline_type, $sub, $alt, $link) { 
    
    ob_start();
    ?>
    <div id="google_translate_element"></div>
    <script type="text/javascript">
    function googleTranslateElementInit() {
    new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
    }
    </script>
    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <?php
    
    $logo .= ob_get_clean();
    return $logo;
    
    }
    
    add_action('avf_logo_final_output', 'add_google_translate_script', 10, 6); 

    Regards,
    Josue

    #301960

    Great nearly there, but it makes the height of the translation box triple the size?

    #302107

    Try adding this code to the Quick CSS:

    #google_translate_element{
    line-height: initial !important;
    }

    To change its position reference the previous codes in this thread.

    Regards,
    Josue

    #302487

    Great many thanks :)

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘google translation plugin’ is closed to new replies.