wp-bootstrap-navwalker icon indicating copy to clipboard operation
wp-bootstrap-navwalker copied to clipboard

Parse error - unexpected 'class' (T_CLASS)

Open apsolut opened this issue 12 years ago • 5 comments

This is problem i get 5th time yet, using underscores.me _S theme...

Parse error: syntax error, unexpected 'class' (T_CLASS) in /public_html/xxx/wp-content/themes/mytheme/inc/wp-bootstrap-navwalker.php on line 1

using

<?php
        wp_nav_menu( array(
            'menu'              => 'Main Menu',
            'theme_location'    => 'main',
            'depth'             => 2,
            'items_wrap' => '<ul id="menu-top-menu" class="%2$s %1$s navbar-nav">%3$s</ul>',
            'container'         => '',
            'container_class'   => '',
            'container_id'      => '',
            'menu_class' => 'nav  main topnav',
            'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
            'walker'            => new wp_bootstrap_navwalker())
            );
?>


register_nav_menus( array(
    'main' => __( 'Main Menu', 'decom' )
) );

apsolut avatar Sep 16 '14 11:09 apsolut

Sorry for the late reply.

This is odd, I build all of my themes with _s and have never run into this issues. did you discover anything additional?

SideQuestDIY avatar Dec 04 '14 01:12 SideQuestDIY

Last 5times didnt get that error.. i guess it have something to do if there is no menu created and its calling it.. `coz last 5times i started with fresh installs and without wp_nav_menu before i created menu in backend... if it show again will note here.

apsolut avatar Dec 04 '14 01:12 apsolut

Very interesting. If you have the fallback_cb value set as you do, there should not be an issue as it will create an assign a single menu item linking to the menu manager if your logged in.

SideQuestDIY avatar Dec 04 '14 17:12 SideQuestDIY

@apsolut did you ever figure out what caused this error?

Since the error is thrown on line 1 of the wp-bootstrap-navwalker.php file I would think that the cause comes directly before the walker is included - rather than there being a problem with the actual walker.

I'm going to close this issue for the moment but if you still have problems come back and reopen it by commenting and I'll take a closer look at what might have happened that caused the error.

pattonwebz avatar Jan 24 '15 05:01 pattonwebz

The problem was IDE, invisible chars on first line and inside start of <php header, also its not everytime, some kind of a bug with eclipse i guess, its random, every X project.. - after i changed editor no errors 2months... - last two times i was updating old projects, the same thing again, error first line etc... so i opened it in other IDE,deleted and added it again (empty space), all started working and errors stoped - without changing anything other than that...

apsolut avatar Jan 24 '15 14:01 apsolut