• Creating a Custom Menu

    by  • August 8, 2011 • Documentation • 5 Comments

    Ordering your navigation menu has always been a bit of a pain. Luckily, the new menu system in WordPress (as of v3.0) makes it as easy as dragging and dropping an item wherever you want. Go to the Appearance panel in your wp-admin and click on the Menus link. Once you are on the Menus page you can add Pages, Categories or Links to your menu and organize them by dragging them around.

    WordPress Menus

    You can even click on the “Screen Options” button in the top right to see more options for your menus. Once your menu is complete, be sure to add it to a Theme location or it will not appear on the front end of your site. PressWork has three theme locations for a custom menu. The Primary and Secondary navigation appear in the header, and the Footer navigation appears in the footer. Some of the menu theme locations need to be added using the PressWork toolbox since they are not activated by default.

    About

    Senior Developer & Co-Founder of PressWork.

    http://bavotasan.com

    5 Responses to Creating a Custom Menu

    1. krimz0815
      September 6, 2011 at 4:44 am

      How do I make a dropdown menu under a category page?

    2. Pingback: role play

    3. Raf
      February 7, 2012 at 3:00 pm

      How can I create “logged-in” and “logged-out” menus? i.e. if I’m logged-in, it shows me one menu, and if I’m logged out, it shows me another.

      Thanks
      Raf

      • Raf
        February 7, 2012 at 4:19 pm

        I see that pw_get_element in functions.php is the function that renders the navigation menu.

        I added two menus to my child-theme:

        if(function_exists(‘register_nav_menu’)) {
        register_nav_menu(‘logged-in’, __(‘Logged In’, “presswork”));
        register_nav_menu(‘logged-out’, __(‘Logged Out’, “presswork”));
        }

        But now if I want to add them to the navigation menu, I am forced to make pw_get_element pluggable (i.e. wrap it with an if(exists())), and copy and paste the function into my child theme’s functions.php, and add my new menus in there:

        if($name==”nav”) {
        $handle = pw_handles(‘Primary Nav Menu’, ‘nav’, true, ‘header’);
        if(function_exists(‘wp_nav_menu’)) {
        echo ”;
        echo $handle;
        echo ”;
        echo ‘Main menu’;
        //!edit – include logins
        if( is_user_logged_in() ){
        wp_nav_menu( array( ‘theme_location’ => ‘logged-in’, ‘sort_column’ => ‘menu_order’, ‘container’ => ”, ‘fallback_cb’ => ‘pw_menu_default’ ) );
        }else{
        wp_nav_menu( array( ‘theme_location’ => ‘logged-out’, ‘sort_column’ => ‘menu_order’, ‘container’ => ”, ‘fallback_cb’ => ‘pw_menu_default’ ) );
        }
        echo ”;
        echo ”;
        }
        }

        Is there any easier way around this?

        Thanks

    4. Ron
      February 22, 2012 at 3:26 am

      This is looking incredible! How are things looking for the next full release?

    Leave a Reply

    Your email address will not be published. Required fields are marked *