Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1054979
    Kerri S
    Participant

    Could you tell me how to add a google translate widget directly above my logo as shown in the attached image? I don’t want it in top bar, I want it right above the logo.

    WP v 4.5.2
    Cornerstone v 1.2.4

    Thanks so much.

    #1055565
    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    Would you mind providing your site’s URL and the google translate code? It may be possible through jQuery.

    Thanks!

    #1055569
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Since you have your child theme active and ready, please follow the following steps below:
    1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
    2] Insert the following code into that new file

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_NAVBAR.PHP
    // -----------------------------------------------------------------------------
    // Outputs the navbar.
    // =============================================================================
    
    $navbar_position = x_get_navbar_positioning();
    $logo_nav_layout = x_get_logo_navigation_layout();
    $is_one_page_nav = x_is_one_page_navigation();
    
    ?>
    
    <?php if ( ( $navbar_position == 'static-top' || $navbar_position == 'fixed-top' || $is_one_page_nav ) && $logo_nav_layout == 'stacked' ) : ?>
    
      <div class="x-logobar">
        <div class="x-logobar-inner">
          <div class="x-container max width">
    
          <?php // Google Translator here ?>
          <?php echo do_shortcode('[google-translator]'); ?>
          <?php // Google Translator here ?>
          
    
            <?php x_get_view( 'global', '_brand' ); ?>
          </div>
        </div>
      </div>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container max width">
              <?php x_get_view( 'global', '_nav', 'primary' ); ?>
            </div>
          </div>
        </div>
      </div>
    
    <?php else : ?>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container max width">
              <?php x_get_view( 'global', '_brand' ); ?>
              <?php x_get_view( 'global', '_nav', 'primary' ); ?>
            </div>
          </div>
        </div>
      </div>
    
    <?php endif; ?>

    3] Save the file named as _navbar.php
    4] Upload this file to your server in the child theme’s folder
    wp-content/themes/x-child/framework/views/global/

    We would loved to know if this has work for you. Thank you.

    #1056238
    Kerri S
    Participant

    Whoa! It totally broker my site LOL! I removed the file and it’s back to normal.
    I’ll attach screens in a private reply for you to view.

    Your instructions were very clear and easy to understand. Thanks for trying!

    #1056244
    Kerri S
    Participant
    This reply has been marked as private.
    #1056252
    Kerri S
    Participant
    This reply has been marked as private.
    #1056604
    Jade
    Moderator

    Hi Kerri,

    I could see that you are trying to add the Google Translate widget in the topbar. By default, shortcodes do not work in the topbar. To enable it, kindly add this code in the function.php in the child theme:

    add_filter('x_option_x_topbar_content', 'top_bar_content_shortcode');
    
    function top_bar_content_shortcode ( $content ) {
        return do_shortcode ( $content );
    }

    Hope this helps.

    #1056769
    Kerri S
    Participant

    Hi Jade,
    Actually, I’m looking to have it right above the logo as shown in the screen shot.

    I was just testing it there to see what it looked like.

    #1057156
    Jade
    Moderator

    Hi Kerri,

    I tried the code suggested in response #1055569 and it is working fine except the flag are aligned to the left.

    To solve that you can add this CSS:

    #flags {
        width: 60px !important;
        margin: 0 auto;
    }

    Kindly adjust the value of the width for flags id in the CSS to contain the flag in one line.

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1054979 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>