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 menĂ¹ section to my WordPress template?

You need to edit functions.php andding the following line <?php register_nav_menu( ‘primary’, ‘Primary Menu’ ); ?> Then go in admin section Apearence-Menus and create one menu In the header replace <?php wp_list_pages(‘title_li=&depth=1’); ?> for example (the primary menu) with: <?php wp_nav_menu( array( ‘theme_location’ => ‘primary’)); ?> more details for nav_menu here

Sticky menu for WP custom menubars

What you could do is the following: 1) Make a javascript-file and put the following content into it: $(function(){ var stickyHeaderTop = $(‘#stickyheader’).offset().top; $(window).scroll(function(){ if( $(window).scrollTop() > stickyHeaderTop ) { $(‘#stickyheader’).css({position: ‘fixed’, top: ‘0px’}); } else { $(‘#stickyheader’).css({position: ‘static’, top: ‘0px’}); } }); }); 2) Save this file in your theme folder as (for example) … Read more

PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content

Those is_page_template call will all be false. The AJAX request is an independent request to the server from the client browser. As far as that AJAX request is concernend the page you are on is admin-ajax.php. You will need to pass a parameter with the AJAX request that you can use to determine which shortcode … Read more

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