• I’m wanting to create a “child theme” of sorts. I have a good 50 pages or so that need a custom drop down menu in the top right corner of the page content. Below all the header stuff, in the actual content stuff itself.

    I’m think duplicate the page.php template and renaming it. Can you help as to what would need to be done to add a second menu location there?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What will populate the menu?

    Thread Starter boionfire81

    (@boionfire81)

    A second menu created in wordpress > appearance > menus

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    So when you’ve found the right template to modify (in your child theme), look at the wp_nav_menu function in Codex. See how it can be used to pull in a specific menu:
    https://codex.wordpress.org/Navigation_Menus#Display_Menus_on_Theme

    Thread Starter boionfire81

    (@boionfire81)

    ok so the functions part would be library/functions/basic-functions

    where

    function register_my_menu() {
      register_nav_menu('header-menu',__( 'Header Menu' ));
    }
    add_action( 'init', 'register_my_menu' );

    should be replaced with

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

    but what I found on line 105 looks more like

    register_nav_menu('primary-menu', __('Primary Menu', 'evolve'));

    and nothing more.

    When I tried using

    register_nav_menu('primary-menu', __('Primary Menu', 'evolve'),
    'extra-menu' => __( 'Extra Menu' )
    );

    I got a blank website…

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The primary menu is already registered, so you don’t want to use that.

    Try creating a menu inside the Appearance > Menus section of the dashboard: https://codex.wordpress.org/File:appearance-menus.png – Give it a unique ‘Menu Name’

    Then in your template file, rather than functions.php file, add this:

    <?php wp_nav_menu( array( 'theme_location' => 'your-custom-menu-name' ) ); ?>

    Thread Starter boionfire81

    (@boionfire81)

    ummm…..where is the file located that will display that??

    all I want to do is recreate the page template and add a drop-down menu in the top right corner. Say ‘menu-task-req’.

    Typically the design is found in page.php, but yours is all over the place, lol!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    That’s the thing, you need to first choose which template file you want to use in your child theme. It’s not mine by the way.

    Thread Starter boionfire81

    (@boionfire81)

    It’s the default page template.

    I think I may have it. But the rename didn’t work for it to show a third page type….

    And sorry. I thought you were the theme designer. lol I didn’t realize your were a mod. My bad.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    When you rename it, make sure you also change the template name at the top of the file – inside the file. This should be in a PHP comment

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘child theme’ is closed to new replies.