WordPress.org

Support

Support » How-To and Troubleshooting » Adding a wordpress menu in my child theme functions.php

Adding a wordpress menu in my child theme functions.php

  • Hello.

    I wish to add a couple of menus to my WordPress menu system. to do this, changes need to be made to the functions.php, but i would like to do this in a child theme so that future updates will not be a problem. I know how the wordpress codex say we should treat functions.php in a child theme, but i can’t seem to do it right. This is the code in the theme functions.php

    function register_main_menus() {
    	register_nav_menus(
    		array(
    			'primary-menu' => __( 'Primary Menu' ),
    			'secondary-menu' => __( 'Secondary Menu' ),
    			'footer-menu' => __( 'Footer Menu' )
    		)
    	);
    }
    if (function_exists('register_nav_menus')) add_action( 'init', 'register_main_menus' );

    Say i for exaple would like to add a specific category menu to the wordpress menu system by adding this in the function:

    'category-menu' => __( 'Category Menu' ),

    How would the code to do this look in the child theme functions.php?

    Anders

  • The topic ‘Adding a wordpress menu in my child theme functions.php’ is closed to new replies.
Skip to toolbar