wp-bootstrap / wp-bootstrap-navwalker

A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.0+ navigation style (v3-branch available for Bootstrap 3) in a custom theme using the WordPress built in menu manager.
https://wp-bootstrap.github.io/wp-bootstrap-navwalker/
GNU General Public License v3.0
3.37k stars 1.94k forks source link

Warning/Errors upon upgrade to 3.6 #17

Closed imaginegrafix closed 11 years ago

imaginegrafix commented 11 years ago

Getting the following messages after upgrading to 3.6:

Strict Standards: Declaration of wp_bootstrap_navwalker::start_lvl() should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in wp_bootstrap_navwalker.php on line 143

Warning: Cannot modify header information - headers already sent by (output started at wp_bootstrap_navwalker.php:143) in wp-includes/option.php on line 571

Warning: Cannot modify header information - headers already sent by (output started at wp_bootstrap_navwalker.php:143) in wp-includes/option.php on line 572

imaginegrafix commented 11 years ago

Removing this block of code seems to fix the issue and everything is functioning on the front end properly, just want to be sure it is safe to remove this:

function start_lvl( &$output, $depth ) {
        $indent = str_repeat( "\t", $depth );
        $output    .= "\n$indent<ul class=\"dropdown-menu\">\n";        
    }
SideQuestDIY commented 11 years ago

Interesting as I don't the that same error with 3.6, are you using version 1.4.3 of the walker?

Removing that block will make it so the menu can only have one level (no dropdowns)

imaginegrafix commented 11 years ago

Yes, using the most current version and using with theme-hybrid - it does seem to be theme specific as if activate twentyten the error messages go away.

Am I losing anything vital by removing that code?

SideQuestDIY commented 11 years ago

You will lose the ability to use dropdown menus. As a point of curiosity can you share your wp_nav_menu() menu declaration block from your theme?

imaginegrafix commented 11 years ago

Thanks for the quick reply - here is what I have:

<?php wp_nav_menu( array( 'theme_location' => 'primary', 'depth' => 2, 'container' => 'nav', 'walker' => new wp_bootstrap_navwalker(), 'container_class' => 'nav-collapse', 'menu_class' => 'nav', 'menu_id' => 'menu-primary-items', 'fallback_cb' => 'wp_page_menu' ) ); ?>
SideQuestDIY commented 11 years ago

Hey @imaginegrafix sorry for the delay, I have been crazy busy. I don't get the same errors on 3.6 and haven't been able to replicate the issue. I merged @wboptimise's commit to add strict declarations, can you try the latest file and let me know if you still have an issue?

imaginegrafix commented 11 years ago

Looks like it is all good now - thanks much; greatly appreciated!

SideQuestDIY commented 11 years ago

Awesome! Glad its working now :)