Support » Themes and Templates » Twenty-Eleven: Menus and white page after functions modification

  • Good morning,
    I’m trying to add menus to a site I’m working on, and I have a couple of questions.
    This is the code I’ve added to functions.php so far, on a previously unedited file, on line 364:
    add_action( ‘init’, ‘register_my_menus’ );

    function register_my_menus() {
    register_nav_menus(
    array(
    ‘energy-menu’ => __( ‘Energy Menu’ ),
    ‘farm-menu’ => __( ‘Farm Menu’ ),
    ‘permaculture-menu’ => __( ‘Permaculture Menu’ )
    )
    );
    }
    Unfortunately, when I uploaded the file, I have a site with just a white screen. Why does this happen? Is the code not in the right place?
    I’ve had function file issues like this before, even if there are no validation errors, and I just gave up. But for this site I HAVE to create custom menus.
    Any help would be awesome!
    Elaine

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    (@esmi)


    Forum Moderator


    Do not edit the Twenty Eleven theme. It is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. First create a child theme for your changes.

    I am using a child theme. I just went back and re-read the functions section of creating a child theme. Instead of using the entire functions file from the parent theme, I just create my *own* file, that loads before and doesn’t replace anything?

    esmi

    (@esmi)


    Forum Moderator


    I just create my *own* file, that loads before and doesn’t replace anything?

    If it contains customised version of any native twentyeleven functions, they will replace the parent’s. And obviously, any new functions you add will also be loaded/available.

    I’ve got it. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Twenty-Eleven: Menus and white page after functions modification’ is closed to new replies.