How to switch between two primary menus (programatically0

You can try this code in specific page template function change_primary_menu( $menu ) { // you can check spesific menu id using this print and after that assign in, // and you can also check menu location using this print too echo ‘<pre>’; print_r($menu) ; echo ‘</pre>’; $user = wp_get_current_user(); //in this example im check … Read more

How to add a template – so that i can choose a different menu for some pages

You can add a new template with a different header. <?php /* Template Name: CustomPageT1 */ ?> <?php //different header for different menu get_header(‘header_name’); ?> <div id=”primary” class=”content-area”> <main id=”main” class=”site-main” role=”main”> <?php // Start the loop. while ( have_posts() ) : the_post(); // Include the page content template. get_template_part( ‘template-parts/content’, ‘page’ ); // If … Read more

How can I order these pages in this navigation bar on this old wordpress theme?

I suggest you change code of your greenday_get_menu_from_pages() function a little bit, just so that the results are not ordered by post_title which is default for get_pages(), but ordered by menu_order, which is what most “page ordering” plugins you have tested actually work with. So here is one new line in your function: function greenday_get_menu_from_pages() … Read more

add_theme_support( $feature=’menus’ )

From the documentation for add_theme_support(): The following parameters are read only, and should only be used in the context of current_theme_supports(): … menus: Use register_nav_menu() or register_nav_menus() instead. … So your theme shouldn’t be using add_theme_support($feature=”menus”) to begin with. Support is automatically added by register_nav_menu(). If you don’t want menu options for your theme, make … Read more