Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #349536

    Alex
    Participant

    Hello,

    I use the latest version of the theme and just now have installed the WMPL plugin and have it set up, but it doesn’t show any language selector in the header or footer.

    Can you help me to set up in properly with your theme? I’m not into PHP or something, I can’t dig into code myself. I have this manual on how to set up selector for the footer:

    https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

    Could you help me to include the selector into header here: http://take.ms/wr1Ad ? Just right after the text in top bar.

    I can style it myself via some CSS, but I don’t really know how to put the selector into header.

    Also, could you please tell if the instructions in the manual above are sufficient to put the selector into footer of your theme? I mean, will it work, is it compatible with your theme? Since it’s very complex theme with Cornerstone plugin and stuff.

    Thank you in advance.


    Alex

    #349583

    Zeshan
    Member

    Hi Alex,

    Thanks for writing in! Since WPML is a 3rd party plugin, we only provide support for its compatibility issues. Any other customization such as adding language selector to the footer can be achieved with custom development but would fall outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding. Take care!

    #349631

    Alex
    Participant

    Okay, thank you.

    #349655

    Thai
    Moderator

    You’re most welcome 🙂

    #349666

    Alex
    Participant

    One more thing, though. 🙂

    Could you at least tell me where I should put this PHP code

    <?php do_action(‘wpml_add_language_selector’); ?>

    if I want to put this into top bar on the right, after the text?

    It would really help and it’s not like development thing, it’s more of a locating some file.

    Thanks, anyway.

    #349706

    Thai
    Moderator

    Hi There,

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
    Then navigate to your child theme’s /framework/views/global directory create a file named _navbar.php and paste the code below:

    <?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 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' );
                do_action('wpml_add_language_selector');
              ?>
            </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; ?>

    Hope it helps.

    #349716

    Alex
    Participant

    Thanks. I already use child theme. I did as you told me, but that didn’t help. I think I have to wait for support from WPML team.

    Thank you, anyway!

    #349773

    Zeshan
    Member

    The workaround may not work depending on your setup or the incorrect code. As this is a custom development, regretfully we cannot provide support for it. You may contact our trusted development partners for custom development: https://community.theme.co//custom-development/

    Thanks for understanding. Take care!

    #350651

    Alex
    Participant

    Thanks for recommendation, but I don’t have the budget to use some developer. Can you help me a little bit more?

    I contacted the WMPL support and they gave me this code based on the code you gave me earlier:

    <?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 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' );
                do_action('wpml_add_language_selector');
              ?>
            </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' ); 
              do_action('wpml_add_language_selector'); ?>
            </div>
          </div>
        </div>
      </div>
      
    <?php endif; ?>

    And now the selector appeared, but not in the top bar, it appeared in the left nav bar:

    http://take.ms/lVR5H

    So how can I move it to the top bar position I marked on the screenshot? Since I managed to get it work and appear on the site, now it’s the matter of putting selector code properly into your top bar file as I understand it. Please help me once more with it.

    Thank you.

    #350654

    Alex
    Participant

    Also, if I want to put selector in the footer, what theme file should I edit and copy to the child theme folder?

    Thanks!

    #350715

    Paul R
    Moderator

    Hi,

    Please create file _topbar.php in wp-content/themes/x-child/framework/views/global
    and copy the code below into that file.

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_TOPBAR.PHP
    // -----------------------------------------------------------------------------
    // Includes topbar output.
    // =============================================================================
    
    ?>
    
    <?php if ( x_get_option( 'x_topbar_display', '' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php endif; ?>
          <?php x_social_global(); ?>
          <?php do_action('wpml_add_language_selector'); ?>
        </div>
      </div>
    
    <?php endif; ?>
    

    Then create file wp-footer.php in wp-content/themes/x-child/framework/views/integrity
    and copy the code below into that file.

    
    <?php
    
    // =============================================================================
    // VIEWS/INTEGRITY/WP-FOOTER.PHP
    // -----------------------------------------------------------------------------
    // Footer output for Integrity.
    // =============================================================================
    
    ?>
    
      <?php x_get_view( 'global', '_header', 'widget-areas' ); ?>
      <?php x_get_view( 'global', '_footer', 'scroll-top' ); ?>
      <?php x_get_view( 'global', '_footer', 'widget-areas' ); ?>
    
      <?php if ( x_get_option( 'x_footer_bottom_display', '1' ) == '1' ) : ?>
    
        <footer class="x-colophon bottom" role="contentinfo">
          <div class="x-container max width">
    
            <?php if ( x_get_option( 'x_footer_menu_display', '1' ) == '1' ) : ?>
              <?php x_get_view( 'global', '_nav', 'footer' ); ?>
            <?php endif; ?>
    
            <?php if ( x_get_option( 'x_footer_social_display', '1' ) == '1' ) : ?>
              <?php x_social_global(); ?>
            <?php endif; ?>
    
            <?php if ( x_get_option( 'x_footer_content_display', '1' ) == '1' ) : ?>
              <div class="x-colophon-content">
                <?php echo x_get_option( 'x_footer_content' ); ?>            
              </div>
            <?php endif; ?>
            <div class="l-selector"><?php do_action('wpml_add_language_selector'); ?></div>
          </div>
        </footer>
    
      <?php endif; ?>
    
    <?php x_get_view( 'global', '_footer' ); ?>
    

    As this is a custom development, further customizations from here is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. https://community.theme.co//custom-development/

    Thank you for understanding. Take care!

    #351896

    Alex
    Participant

    Thank you.

    #352007

    Prasant Rai
    Moderator

    You are most welcome 🙂 .