I’m trying to add another sidebar to my WordPress theme (Titan – http://wordpress.org/extend/themes/titan), but it seems to be a little more advanced than the themes being used in the tutorials.
I’ve been following this guide
http://www.blogohblog.com/adding-extra-sidebar-to-your-wordpress-theme/
My Functions.php looks like this
<?php
locate_template( array( 'functions' . DIRECTORY_SEPARATOR . 'titan-extend.php' ), true );
And the relevant block titan-extend.php file that I’ve been hacking away at looks like this
/*---------------------------------------------------------
6. Register Sidebars
------------------------------------------------------------ */
function registerSidebars() {
register_sidebar(array(
'name' => __( 'Sidebar', 'titan' ),
'id' => 'normal_sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
register_sidebar(array(
'name' => 'sidebar2'));
'id' => 'sidebar2'
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
}
The current error I’m getting is
Fatal error: Cannot redeclare Titan::registerSidebars() in /wp-content/themes/titan/functions/titan-extend.php on line 121
That’s all the info I have, any and all help is appreciated
The tutorial your referring to is outdated and doesn’t user WordPress best practices.
The proper way to register sidebar is to create a register function then hook it into
widgets_init
in your functions.php file add this:
See Justin Tadlock’s Sidebars in WordPress post.