Theme modification for custom category menus

As indicated above, I discovered the answer to my own question. You do not need single quotes or brackets around the variable. The fact that the variable is a string itself is sufficient. The correct code is below: <?php $cat = get_the_category(); $catSlug = $cat[0]->slug; $catMenu = $catSlug . “-nav-menu”; $options = array( ‘container’=>’nav’, ‘container_class’=>’menu-header’, … Read more

Confused about the correct functioning on WordPress Menus

Greetings and thanks for posting on the forums. If you want to register a single nav menu then use the function register_nav_menu instead of register_nav_menus as following to register it. if ( function_exists(‘register_nav_menus’)) { register_nav_menu( ‘main’, ‘Main Nav’ ); } Note: The function register_nav_menu automatically registers custom menu support for the theme therefore you do … Read more

Custom navigation menu with awsAccordion

After reading PHP and wordpress codex i achieved what i wanted, by making a walker class. Here is the code class Hambos_Walker_Nav_Menu extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat(“\t”, $depth); if ($depth == 0): $output .= “\n$indent <div>\n”; else: $output .= “\n$indent <ul>\n”; endif; } … Read more

I can’t add more pages to menu – menu delete pages

Most likely explanation is that you’ve hit a PHP limit here – namely max_input_vars. A more thorough explanation can be found here. The solution is not inside WordPress I’m afraid, you’re gonna have to venture into your site’s PHP settings. Or, of course, reorganize your menus into something more manageable.

Hook on creating a menu entry?

If you check out the source, you find the following actions related to the modifications of the navigational menus: Update: /** * Fires after a navigation menu has been successfully updated. * * @since 3.0.0 * * @param int $menu_id ID of the updated menu. * @param array $menu_data An array of menu data. */ … Read more

WP_NAV_MENU filter targets all menus

You could try the following code snippet to override the primary menu: /** * Override the primary menu. * * @param string $nav_menu The HTML content for the navigation menu. * @param array $args Array of wp_nav_menu() arguments. * @return string $nav_menu */ function wpse_150003( $nav_menu, $args ) { //Override the primary menu: if( ‘primary’ … Read more

WP nav menu + Bootstrap, add role=”menu” to UL

[Update] Solution found: I was looking for ‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s” role=”menu” >%3$s</ul>’ <?php wp_nav_menu( array( ‘menu’ => ‘menu’, ‘theme_location’ => ‘menu’, ‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s” role=”menu” >%3$s</ul>’, ‘depth’ => 0, ‘container’ => ”, ‘menu_class’ => ‘dropdown-menu’, ‘fallback_cb’ => ‘wp_bootstrap_navwalker::fallback’, ‘walker’ => new wp_bootstrap_navwalker()) ); ?>

Customise the custom menu widget

Here I have copied the Class used from the WordPress Core for you and then updated the Class name, Updated_WP_Nav_Menu_Widget that it is extending and used the widgets_init() action to register the widgit. /** * Navigation Menu widget class * * @since 3.0.0 */ class Updated_WP_Nav_Menu_Widget extends WP_Widget { function __construct() { $widget_ops = array( … Read more