Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Used code I found on css tricks to remove the li tags from wp_nav_menu.

$menu_parameters = array(
'container'       => false,
'echo'            => false,
'items_wrap'      => '%3$s',
'depth'           => 0,
);

<?php echo strip_tags(wp_nav_menu( $menu_parameters ), '<a>' ); ?>

I placed $menu_parameters in functions.php and called it in my index file and everything was working great until I separated my index files into their appropriate php files. After I moved the strip_tag function into the header.php and then called it using get_header, the nav now falls back to the wp default. Any ideas?

share|improve this question
    
Are you familiar with the concept of variable scope in PHP? –  Milo Aug 19 at 20:26
    
This is not how you get the links, you are wasting resources to build the li elements you then try to throw away. Use a custom walker instead. –  toscho Aug 19 at 20:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.