X - WPML switcher in logobar

Hi

I’m actually on X and can’t switch on Pro now that the website is finished and I’m only setting up the other languages.

My idea is to put the language switcher inside the logobar so the logo stays on the left and the switcher on the right.

Is there a way to edit the header’s logobar section to put the wpml code inside? I really can’t find the way.

Thanks

Hey @snowtura,

This would need template overriding in X. Here’s the general instruction for that: https://theme.co/docs/best-practices

Having read the article, you now know that you need to use a child theme and how to override templates. The template you need to override or add the WPML Language Switch code is the _navbar.php which you can find in \wp-content\themes\x\framework\legacy\cranium\headers\views\global folder in your server.

Insert the code anywhere inside the Logo Bar structure.

Please note that we do not provide custom development. If you have issues integrating the WPML Language Switcher, you will need to hire a web developer to provide a fix.

Hope that helps and thank you for understanding.

Hi!
I did follow these instructions but even if I did modify the _navbar.php after setting it in the new folder, no changes appears. May I missed something?

Nothing changes and I dunno why.

Thanks for your help.

Hello @snowtura,

Can you please provide your complete code in your _navbar.php file?
It should be something like this:

<?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 // ============================================================================= ?>
      	<div class="left">
        	<?php x_get_view( 'global', '_brand' ); ?>
        </div>

        <div class="right">
        	<p>Your WPML switcher code here</p>
        </div>

        <?php // ============================================================================= ?>

      </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; ?>

Kindly let us know how it goes.

It’s like that.
For testing purposes, I tried your code, copy-paste, and nothing appears (even keeping the “Your WPML switcher code here” text).

I think I did something wrong with the installation of the child theme.

Hi @snowtura,

Is there a chance that you can provide us with the admin and FTP access to your site in a Secure Note:

Sure.
Thanks in advance.

Hi @snowtura,

Thank you for the credentials. I have checked the file. It is on the correct folder path. There’s an error though.
This line
<p>do_action('wpml_add_language_selector'); </p>
Should be like this because it is a php code snippet:
<p><?php do_action('wpml_add_language_selector'); ?></p>

Unfortunately, even if update the file already, nothing happens. There’s no changes on the frontend. Possible reason might be server cache. Please check and clear cache on your server. Check again after that. Let us know how this goes.

Hi. Thanks for help.

I’m waiting for an answer from the hosting provider about server cache.

What if child theme installation had some issues? Should I try uninstall child theme e re-install it?
Is there a specific procedure of I just need to reactivate X main theme, uninstall child theme, erase x-child directory and re-install?

Thanks

Hello @snowtura,

I have re installed your child theme along with the changes added to the _navbar.php file. You should now be seeing the “Your WPML switcher code here” text on the right side.

With the changes given by @Lely and a custom css in your child theme’s style.css:

.wpml-ls-legacy-list-vertical .wpml-ls-item {
    display: inline-block;
}

Please check your header now.

Sorry but I was so happy that I didn’t check anything.

I see the switcher and it’s good but I still don’t understand why I can’t make any changes.
If I now download the _navbar.php file I don’t see the code as you set it up (i.e. the “right pam” class)

I think this is still a server cache problem but I don’t understand how you made it and why I can’t see it.

Cheers
Alessandro

Hello Alessandro,

You do not need to download anything. Simply go to Appearance > Theme Editor to edit the file.

Hope this helps. Kindly let us know.

Now everything works.
Thanks for your time helping me.

Cheers!

You’re welcome!
We’re glad we were able to help you out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.