• Hi Everyone,
    I created a 3rd menu for my a theme I purchased (MayaShop Theme) and I’m running into some issues. I am working with a child theme so in the Functions.php file of the child theme I added

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

    Which basically got my menu to appear in the backend menu area. I then needed to call out the menu in the template file (please excuse my terminology I’m not too sharp when it comes to PHP). So I needed to add the follow( I believe please feel free to correct me if I’m wrong 😀 ):

    <?php if ( function_exists('has_nav_menu') && has_nav_menu('nav') && has_nav_menu('header-middle-menu') ) {
    
            wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'secondary-nav', 'menu_class' => 'nav fl', 'theme_location' => 'header-middle-menu' ) );
        }?>

    Now I normally would add this to the Header.php file however since I am working with a Child theme I’m not sure the best way to go about doing this. Is there a function I can add to the “Function.php” file to somehow insert that line of code into the parent header.php?

    Or is the only way to copy the parent’s header.php file into the child theme and make the altercations there.

    Thanks in advance for your time and support!

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m pretty sure you just copy the template files you want to edit from the parent folder to the child. I haven’t tried a child theme but that’s what I’ve read. You shouldn’t even have to change or rename anything.

    Thread Starter christinarule

    (@christinarule)

    Hey thanks for the response. So what about when the parent theme(heaper.php) updates that means that the child theme(header.php) wouldn’t be updated correct? Doesn’t that make you more vulnerable to potential security issues? Should I not update my wordpress if that is the case?

    it’s why I don’t use child themes, I’m not sure I understand the idea. I use custom pages instead. They get over written in theme updates but I just re copy them to the updated theme folder.

    Easy theme edits are routine for me becuse I only use 3 different themes on over a dozen sites. I’m very familiar with them and it’s really no big deal to re-do.

    Also, I try to use css rather than change the actual theme files whenever possible. I add all my changes at the bottom of the stylesheet and copy/save them. WhenI update a theme I just paste my edits below the updated stylesheet.

    Thread Starter christinarule

    (@christinarule)

    Deepbevel,
    Great idea! I actually started creating a text file and just making notes of all the changes I’ve made and then just added that in my theme folder.

    I’d love to hear the 3 themes use, what are they?

    Twentyten is the most stable, flexible, compatible and multi purpose. I’m the most familiar with this one. Seems the easiest to customize.

    Custom Community is a great theme with tons of sdmin style settings, and great built-in optional post format, category page, and post slider features. It’s also compatible with Buddypress. It has it’s own “child-theme” style css field, and has a built in data base back up. Harder to customize but I’ve become quite familiar.

    Minimatica is a portfolio style theme, has a minimal style (image only) optional post-page slider bulit in. I like this one for it’s style, I consider it a real aesthetic masterpiecee of a theme and I don’t change it much. But the hardest of the 3 to customize.

    I want to start using the Portfolio theme by Raygun. I love thier Portfolio Slidshow plugin, and they have great support.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to create a new menu using Child theme’ is closed to new replies.