WordPress.org

Ready to get started?Download WordPress

Forums

Twenty-Eleven: Menus and white page after functions modification (5 posts)

  1. Elaine Griffin
    Member
    Posted 2 years ago #

    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

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  3. Elaine Griffin
    Member
    Posted 2 years ago #

    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?

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  5. Elaine Griffin
    Member
    Posted 2 years ago #

    I've got it. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic