Specific cloud template header and footer by URL

Posted in: Newspaper
Post count: 95

Hi!

I need to use a specific cloud template header and footer only in some parts of the website, when the phrase “/en/” (english site) is in the URL of the site like mysite.com/en/about (yes), mysite.com/chi-siamo (no), without setting it manually. This thing waiting to switch to WPML plugin.

Can you suggest me a code snippet to put in the functions.php file?

In the past, when I not use cloud template, I used for menu:

// Function to use specific menu on different page
add_filter( ‘wp_nav_menu_args’, ‘menu_switcher’ );
function menu_switcher( $args ){
$url = ‘https://’ . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];
if (strpos($url,’/en/’) !== false) {
if( ‘header-menu’ == $args[‘theme_location’] )
$args[‘menu’] = ‘Principale EN’;
}
return $args;
}

Thanks!

Post count: 35449

Hi,

In such cases, we recommend using WPML with cloud templates – https://forum.tagdiv.com/using-theme-translations-together-wpml/

As an alternative, maybe that function can be combined with this one – https://pastebin.com/d7nU6Y92

Thank you!

Post count: 95

I fixed it, finally I decided not to use header and footer cloud templates. Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.