I have a child theme of 2010.
I have managed to add more menus by using this code in child functions :
<?php
// Remove the default 'register_nav_menus' function
function remove_register_nav_menus() {
remove_action( 'twentyten_setup', 'register_nav_menus' );
}
// Call 'remove_register_nav_menus' (above) during WP initialization
add_action('after_setup_theme','remove_register_nav_menus');
// Register new 'register_nav_menus' function by running 'register_nav_menus' on the 'twentyten_setup' hook. */
add_action( 'twentyten_setup', 'register_nav_menus' );
// This child theme uses wp_nav_menu() in three locations.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
'secondary' => __( 'Sidebar Menu', 'twentyten' ),
'third' => __( 'Bruce Sidebar Menu', 'twentyten' ),
) );
?>
This is all fine and good, works great.
But now when ever I try to add any other code to the functions file, I get errors.
I am trying to set up a custom sidebar using:
<?php
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
/* Register the 'bcindex' sidebar. */
register_sidebar(
array(
'id' => 'bcindex',
'name' => __( 'bcindex' ),
'description' => __( 'Sidebar for Bruce Cockburn main page.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
/* Repeat register_sidebar() code for additional sidebars. */
}
?>
This actually registers a side bar visible in widgets, but as soon as I attempt to do anything an error code comes up:
This is one from attempting to save a css change:
Warning: Cannot modify header information - headers already sent by (output started at /home/****/public_html/**********/wp-content/themes/twentytenchild/functions.php:24) in /home/****/public_html/*(******.com/wp-admin/theme-editor.php on line 89
This is one from trying to save a page modification:
Warning: Cannot modify header information - headers already sent by (output started at /home/****/public_html/********.com/wp-content/themes/twentytenchild/functions.php:24) in /home/****/public_html/******.com/wp-includes/pluggable.php on line 890
Is there something in the first part of this functions file that is causing these errors?
This isn't the first code I have tried to use to get custom sidebars, every time I try to add anything to functions -- these errors come up.
If I go back to just the menu set up in functions all is good.
But I want to add custom sidebars.