Forums

Change sidebar for custom template (3 posts)

  1. bigshift
    Member
    Posted 2 years ago #

    I have managed to change my functions.php file to allow me to create multiple sidebars/etc. with widgets here is a small sampling...

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => 'Sidebar 1',
            'before_widget' => '<div id="widget-%1$s" class="sidebar-box %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));
    register_sidebar(array(
    		'name' => 'Sidebar 2',
            'before_widget' => '<div id="widget-%1$s" class="sidebar-box %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));

    I have also managed to create an about.php template. Now to swap sidebars on this page, I thought it would be as simple as swapping out this line...

    <?php include ('sidebar 2.php'); ?>

    with

    <?php get_sidebar(); ?>

    However, that continually returns an error. So I am evidently missing something. Any thoughts?

    Thanks

  2. Edward Caissie
    Member
    Posted 2 years ago #

    Have a look at this page in the codex: http://codex.wordpress.org/Include_Tags

    The code above you are showing is for creating widget areas in your sidebar(s) ... it does not create the actual template file(s).

  3. Sarah Gooding
    Member
    Posted 2 years ago #

    I just posted a blog about creating custom sidebars, headers, footers, etc. You can find the solution by using custom fields. Check out the quick tutorial here:
    http://wpmu.org/making-wordpress-more-modular-with-multiple-sidebars-headers-and-footers

Topic Closed

This topic has been closed to new replies.

About this Topic