Author Topic: Two Sidebards in Wordpress  (Read 225 times)

ianbee

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Two Sidebards in Wordpress
« on: August 13, 2012, 12:30:03 PM »
Hi everyone, I'm trying to create two sidebars that work with widgets.  Right now my theme I downloaded has one widget-working sidebar. Here's the coding for functions.php


PHP Code: [Select]
 */
function 
sundance_widgets_init() {
	
register_sidebar( array(
	
	
'name' => __'Sidebar''sundance' ),
	
	
'id' => 'sidebar-1',
	
	
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
	
	
'after_widget' => "</aside>",
	
	
'before_title' => '<h1 class="widget-title">',
	
	
'after_title' => '</h1>',
	
) );
}
add_action'widgets_init''sundance_widgets_init' );

/**


And here is the code for the sidebar.php:

PHP Code: [Select]
<?php
/**
 * The Sidebar containing the main widget areas.
 *
 * @package Sundance
 * @since Sundance 1.0
 */
?>
<?php
	
$options sundance_get_theme_options();
	
if ( 
'off' == $options['show_rss_link']
	
	
&& 
''  == $options['twitter_url']
	
	
&& 
''  == $options['facebook_url']
	
	
&& 
''  == $options['google_url']
	
	
&& 
''  == $options['flickr_url']
	
	
&& ! 
is_active_sidebar'sidebar-1' )
	
)
	
	
return;
?>

	
	
<div id="secondary" class="widget-area" role="complementary">
	
	
	
<?php do_action'before_sidebar' ); ?>

	
	
	
<?php
	
	
	
	
if ( 
'off' != $options['show_rss_link']
	
	
	
	
	
|| 
''  != $options['twitter_url']
	
	
	
	
	
|| 
''  != $options['facebook_url']
	
	
	
	
	
|| 
''  != $options['google_url']
	
	
	
	
	
|| 
''  != $options['flickr_url']
	
	
	
	
) :
	
	
	
?>
	
	
	
	
<div class="syndicate">
	
	
	
	
	
<ul>
	
	
	
	
	
	
<?php if ( 'off' != $options['show_rss_link'] ) : ?>
	
	
	
	
	
	
	
<li><a class="rss-link" href="<?php echo get_feed_link'rss2' ); ?>" title="<?php esc_attr_e'RSS''sundance' ); ?>"><span><?php _e'RSS Feed''sundance' ); ?></span></a></li>
	
	
	
	
	
	
<?php endif; ?>

	
	
	
	
	
	
<?php if ( ''!= $options['twitter_url'] ) : ?>
	
	
	
	
	
	
	
<li><a class="twitter-link" href="<?php echo esc_url$options['twitter_url'] ); ?>" title="<?php esc_attr_e'Twitter''sundance' ); ?>"><span><?php _e'Twitter''sundance' ); ?></span></a></li>
	
	
	
	
	
	
<?php endif; ?>

	
	
	
	
	
	
<?php if ( ''!= $options['facebook_url'] ) : ?>
	
	
	
	
	
	
	
<li><a class="facebook-link" href="<?php echo esc_url$options['facebook_url'] ); ?>" title="<?php esc_attr_e'Facebook''sundance' ); ?>"><span><?php _e'Facebook''sundance' ); ?></span></a></li>
	
	
	
	
	
	
<?php endif; ?>

	
	
	
	
	
	
<?php if ( ''!= $options['google_url'] ) : ?>
	
	
	
	
	
	
	
<li><a class="google-link" href="<?php echo esc_url$options['google_url'] ); ?>" title="<?php esc_attr_e'Google+''sundance' ); ?>"><span><?php _e'Google Plus''sundance' ); ?></span></a></li>
	
	
	
	
	
	
<?php endif; ?>

	
	
	
	
	
	
<?php if ( ''!= $options['flickr_url'] ) : ?>
	
	
	
	
	
	
	
<li><a class="flickr-link" href="<?php echo esc_url$options['flickr_url'] ); ?>" title="<?php esc_attr_e'Flickr''sundance' ); ?>"><span><?php _e'Flickr''sundance' ); ?></span></a></li>
	
	
	
	
	
	
<?php endif; ?>

	
	
	
	
	
</ul>
	
	
	
	
</div><!-- .syndicate -->
	
	
	
<?php endif; ?>

	
	
	
<?php if ( is_active_sidebar'sidebar-1' ) ) : ?>

	
	
	
	
<?php dynamic_sidebar'sidebar-1' ); ?>

	
	
	
<?php endif; // end sidebar widget area ?>
	
	
</div><!-- #secondary .widget-area -->


I tried creating a sidebar2.php and changing the php settings within that page to "sidebar-2" not "sidebar-1" and copy and pasted the code
PHP Code: [Select]
 'name' => __'Sidebar''sundance' ), 'id' => 'sidebar-1',
and changed it to sidebar-2. But that just broke my theme.

Any suggestions?

ianbee

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Two Sidebards in Wordpress
« Reply #1 on: August 13, 2012, 01:01:40 PM »
figured it out myself, thanks.