Polylang language switcher PHP not working after site migration

Hello!

I have a problem with a PHP file not working after site migration from a local build to a live server. On this site I have installed the Polylang translations plugin and added a language switcher to the topbar via php. I created the PHP file with help from this thread:

The language selector disappeared after the migration. The _topbar.php file can still be found where it should be, but for some reason it doesn’t work.

I tried to solve this with my hosting provider, but we couldn’t find an answer. Could someone help me with this problem, please?

The site is currently hosted on a temporary server:
http://31.217.192.106/~linercom/

Hi Marcus,

Thanks for writing in! First of all, please follow our migration guide here first (https://theme.co/apex/forum/t/cornerstone-content-builder-migration/126/1) and see if you have migrated your site correctly.

Then install the following plugin on your both sites (https://wordpress.org/plugins/wp-serverinfo/), head over to Dashboard -> WP Serverinfo and compare the following information.

For further troubleshooting, I suggest you to enable WP_DEBUG mode (https://codex.wordpress.org/WP_DEBUG) and then revisit your site to see if there’s any PHP errors.

Hope that helps.

Hello @mldarshana

Thank you for your answer! I migrated the site with the WP Migrate DB plugin and unfortunately the language switcher is still missing. Everything else on the site is working.

I’m not seeing any PHP errors. I also enabled Polylangs error log, but it didn’t show any errors either. Should I still try to change the PHP max script execution time to 120? At the moment it is the default 30, which matches the local server. PHP version and the memory limit match on both sites.

Hi,

Try to move your file in wp-content/themes/x-child/framework/legacy/cranium/headers/views/global

Then change the code in it with this.

<?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(); ?>
<ul class="language-switcher right">
      	<?php pll_the_languages();?>
      </ul>

    </div>
  </div>

<?php endif; ?>

Hope that helps.

Hi!

Problem solved! Thank you so much. You have saved my day!

Glad to hear it’s sorted, Marcus.

Cheers!

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