...

View Full Version : adding extra wordpress widget sidebar



ikidunot
07-31-2010, 09:37 AM
i know this mainly deals with php but the php forum seemed to focus more on server sided issues so i decided to post here.

my site is www.ravegrounds.com and im trying to add a sidebar in the middle where the one recent post is located so the site would become 3 column, 2 of which would be widgetized sidebars.

i inserted a new sidebar called "middle" based off of the sidebar "primary" that already existed in the file called sidebar-init.php. everything is good at this point because the new menu shows up in my admin area.


<?php

// Register widgetized areas

function the_widgets_init() {
if ( !function_exists('register_sidebars') )
return;

register_sidebar(array('name' => 'Primary','id' => 'primary','description' => "Normal full width Sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));

register_sidebar(array('name' => 'Middle','id' => 'middle','description' => "Normal full width Sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));

register_sidebar(array('name' => 'Secondary Left','id' => 'secondary-1', 'description' => "Left column (part of 2-col sidebar)", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));
register_sidebar(array('name' => 'Secondary Right','id' => 'secondary-2', 'description' => "Right column (part of 2-col sidebar)", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));
register_sidebar(array('name' => 'Footer 1','id' => 'footer-1', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 2','id' => 'footer-2', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 3','id' => 'footer-3', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
register_sidebar(array('name' => 'Footer 4','id' => 'footer-4', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
}

add_action( 'init', 'the_widgets_init' );



?>

then i made a new file called sidebar2.php based off an file that was already there called sidebar.php. the new file looks like this


<div id="sidebar" class="col-right">

<?php if (is_active_sidebar('middle')) : ?>
<div class="middle">
<?php dynamic_sidebar('middle'); ?>
</div>
<?php endif; ?>

</div><!-- /#sidebar -->

every time i post

<?php get_sidebar2(); ?>
in my index file, all the existing sidebar will disappear on my site. can someone see if i am missing something?

Major Payne
08-01-2010, 03:09 PM
Might help:

Managing Plugins: http://codex.wordpress.org/Managing_Plugins

Plugins can extend WordPress: http://wordpress.org/extend/plugins/

33 Wordpress Plugins To Power Up Your Comment Section: http://www.1stwebdesigner.com/wordpress/33-wordpress-plugins-to-power-up-your-comment-section/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum