Change the Pimary menu using php
-
Hello,
I’d like to change the primary menu (both full screen and mobile burger) within a plugin and not having much luck with the code snippets found on the web. What I am finding is that I can change full sreen menu but the theme layout is ignored and the burger menu is empty when in moble view.
I have a filter
$this->loader->wp_add_filter('wp_nav_menu', array( $this->loader, 'select_plugin_nav_menu' ), '10', '2');
which calls
public function select_plugin_nav_menu($html, $args) { if ($args->theme_location == THEME_NAV_MENU_LOCATION) { wp_nav_menu(array( 'menu' => $menu_to_show, 'menu_class' => 'nav-menu' )); } return $html; }
Please could you advise how I can correctly change the primary menu within php?
Thanks
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Change the Pimary menu using php’ is closed to new replies.