Hi you reading,
I'm presently doing a website for someone, and his website has 2 sections. I want to change the main_navigation menu in relation to the section the user is currently on.
I did this by creating a child-theme and editing the header-main-menu.php file. Here's how I do it:
<?php
if(!$data['ubermenu']) {
$sectionname = get_permalink();
$menu_id = (strpos($sectionname, 'technical-furniture') !== false ? 3 : 8);
$mods = get_option("theme_mods_avada-child");
$mods['nav_menu_locations']['main_navigation'] = $menu_id;
update_option("theme_mods_avada-child", $mods);
echo $main_menu;
} else {
uberMenu_direct( 'main_navigation' );
}
?>
I don't know why, but I have to refresh twice for the menu to change.FYI, I did disable the cache in the wp-config.php file by writing :
define('DISABLE_CACHE', true);
at the end of the file.
Do you guys have any idea what causes this or how to troubleshoot myself?
Thanks thank you for taking the time to read my question.
SLAF