Remove first separator in wp_nav_menu

If all you’re attempting to do is add a separator between links you’d be better off just scrapping what you have and do this: Create a new menu in the WP backend. Add your pages/links and save the menu. Then just use <?php wp_nav_menu( array(‘menu’ => ‘Name of Menu Here’ )); ?> to display your … Read more

Get current menu item label for specific parent menu [closed]

Add the following empty div where you want to display current menu label <div class=”menu-label-container”></div> and add the following script in footer of the page. jQuery(document).ready(function(){ if(jQuery(‘#nav li.current-menu-item a’).html()) jQuery(‘.menu-label-container’).html(jQuery(‘#nav li.current-menu-item a’).html()); }); Tell me whether this solution is working for you or i will find another solution.

How to add a page to header that is outside of WordPress?

The code you want is: <?php include ‘yourfile.php’ ?> Place the file in the same directory as header.php. EDIT: depending on the nature of the content, and how often you will reuse, you may also choose to use this: http://codex.wordpress.org/Function_Reference/get_template_part

Why Isn’t My WP_Nav_Menu returning false?

it doesn’t return false because the menu exists in every case, you’re just unsetting all of the menu items. you’re not setting an items_wrap arg, so that defaults to the ul wrapper. maybe try removing it by setting it explicitly to just the child items: ‘items_wrap’ => ‘%3$s’ note, you’ll then have to manually wrap … Read more

Rename menu items for All except super admin

/** * Changes Label of Admin Menu items * @global array $menu * @global array $submenu */ function change_post_menu_label() { global $menu; global $submenu; $menu[2][0] = ‘Home’; $menu[5][0] = ‘Articles’; $submenu[‘edit.php’][5][0] = “All Articles”; // var_dump($submenu); // var_dump($menu); echo ”; } if(!is_super_admin()){ add_action( ‘admin_menu’, ‘change_post_menu_label’ ); } You can print the array echo “<pre>”; print_r($menu); … Read more

Hide a menu on posts

if (is_single()) { // DONT SHOW MENUS } you may pass a post id for any specific post for eg – if (is_single(‘4’)) { // DONT SHOW MENUS } will execute on post with id = 4 . hope it helps