Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Shaun Taylor
Shaun Taylor
2,654 Points

Wordpress Menu...

Hi,

I have two menu area on my site - a 'footer-nav' and a 'main-menu' - Today I updated Wordpress to version 4.0.

Inside all of those areas I obviously have a main menu and a footer menu set up and showing.

Now the footer menu is appearing in both the footer area AND the header area - I agent changed any code - all I have done it update to the latest version of Wordpress...

Here's the site: http://seedcreativehub.co.uk

The code in my Functions file to enable both headers is this:

<?php
add_theme_support( 'menus' );
add_theme_support( 'post-thumbnails' );

function register_theme_menus() {
    register_nav_menus(
        array(
            'header-menu'   => __( 'Header Menu' )
        )
    );
}
add_action( 'init', 'register_theme_menus' );

//and

create_widget( 'Footer Nav', 'footer-nav', 'Displays the navigation in the footer' );
?>

The Code in my header.php file is this:

<?php
            $args = array(
              'menu'        =>  'header-menu',
              'menu_class'  =>  'nav navbar-nav',
              'container'  =>  'false'
            );
            wp_nav_menu( $args );
          ?>

The code in my footer.php is this:

<?php if ( dynamic_sidebar( 'footer-nav' ) ); ?>

Any help would be greatly appreciated!! I can't even begin to imagine whats changed in the update?

Thanks, Shaun.

2 Answers

Shaun Taylor
Shaun Taylor
2,654 Points

Hi Giuseppe,

Thank you for the kind words :) Primarily I'm a pro designer... but I'm picking up Wordpress as I go along so at certain points I get stuck...

Late last night I actually solved the bug!! Apologies for not updating sooner...

I had two menus one called Footer Menu and one called Main Menu... Apparently, when I installed Wordpress 4.0, it uses the menus in alphabetical order! so automatically it put the Footer Menu at the top ( for some reason I'm still not sure on) - So... for the fix, I renames my main menu to 'AAA Main Menu' because of the AAA, it was now first alphabetically, and it seemed to fix the problem - The menu returned.

Thank you you for the reply! Ill look into the navwalker thing and see what its like :)

Thanks,

Shaun.

Giuseppe Elia Brandi
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Giuseppe Elia Brandi
Front End Web Development Techdegree Graduate 69,630 Points

Good Day Shaun, Firstly, congratulations on your good looking website - you are a PRO! (I have done some research on you). I have checked your website but I cannot see any problem with the footer menu appearing on the header. Have you already solved the bug or are you referring to the social media buttons on the top of the page? Best Regards.

Giuseppe Brandi

P.S. it would have been interesting to see the implementation of wp-bootstrap navwalker for the Media Feed link