Style wp_page_menu() items

Please find below the function for showing navigation menu. Here, $menu is equivalent to Menu name, ID, or slug <?php function showMyMenu($menu) { $navData = wp_get_nav_menu_items($menu); ?> <ul class=”nav navbar-nav navbar-right is-hidden”> <?php foreach($navData as $k => $v) { echo ‘<li><a class=”page-link” href=”‘ . $v->url . ‘”> ‘ . $v->title . ‘ </a></li>’; } ?> … Read more

menu behavior is not as expected

First thing i would do is register 2 menus, <?php function register_my_menus() {register_nav_menus(array(‘primary’ => __( ‘Primary Menu’ ),’topnav’ => __( ‘Top Nav Menu’ ) ) ); } add_action( ‘init’, ‘register_my_menus’ ); ?> second in wordpress menu panel i would create two menus and assign each to a display location Third i would display the menus … Read more

Disabling ‘posts’ in Appearance > Menus

We can use the register_post_type_args filter to adjust how the post post type is displayed in the backend with e.g.: add_filter( ‘register_post_type_args’, function( $args, $name ) { if( ‘post’ === $name ) { // $args[‘show_ui’] = false; // Display the user-interface $args[‘show_in_nav_menus’] = false; // Display for selection in navigation menus $args[‘show_in_menu’] = false; // … Read more

Add notification bubble notice in navigation using transients

Thanks again for the help @jdm2112. Updated a few syntax errors and used the same structure you suggested, works great! // Add notification bubble to custom post type menu nav add_action( ‘admin_menu’, ‘add_cpt_menu_bubble’ ); function add_cpt_menu_bubble() { global $menu; $count_posts = tms_count_pending_posts(); if ( $count_posts > 3 ) { foreach ( $menu as $key => … Read more

Must a page be published in order to be added to menu?

The page must be published, as detailed in the “Adding Items to a Menu” section of the WordPress Codex WordPress Menu User Guide: You can add different link types into your menu, these are split between panes left of the menu you’re currently editing. Locate the pane entitled Pages. Within this pane, select the View … Read more