child theme
-
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?
-
What will populate the menu?
A second menu created in wordpress > appearance > menus
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_Themeok 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…
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' ) ); ?>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!
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.
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.
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
The topic ‘child theme’ is closed to new replies.
