Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improved sidebar behaviour. fixed bottom sidebar not displaying widge…

…ts properly.
  • Loading branch information...
commit db313e43b9933ec9d4c048ed8b5f4c38f503c8f0 1 parent e9c7c0d
@zyml authored
Showing with 16 additions and 10 deletions.
  1. +1 −1  footer.php
  2. +8 −4 functions.php
  3. +6 −4 home.php
  4. +1 −1  sidebar.php
View
2  footer.php
@@ -11,7 +11,7 @@
for ($i = 1; $i < $footer_sidebars + 1; $i++) :
?>
<div id="footer-sidebar-<?php echo $i ?>" class="footer-sidebar clearfix xoxo">
- <?php if ( !dynamic_sidebar('Footer Sidebar #' . $i) ) : ?>
+ <?php if ( !dynamic_sidebar( 'footer-sidebar-' . $i ) ) : ?>
<?php endif; ?>
</div>
<?php endfor; ?>
View
12 functions.php
@@ -110,21 +110,24 @@ function ar2_add_sidebars() {
/* Default sidebars */
register_sidebar( array(
- 'name' => 'Primary Sidebar',
+ 'name' => __( 'Primary Sidebar', 'ar2' ),
+ 'id' => 'primary-sidebar',
'before_widget' => '<aside id="%1$s" class="widget clearfix">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
) );
register_sidebar( array(
- 'name' => 'Bottom Content #1',
+ 'name' => __( 'Bottom Content #1', 'ar2' ),
+ 'id' => 'bottom-content-1',
'before_widget' => '<aside id="%1$s" class="widget clearfix">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
) );
register_sidebar( array(
- 'name' => 'Bottom Content #2',
+ 'name' => __( 'Bottom Content #2', 'ar2' ),
+ 'id' => 'bottom-content-2',
'before_widget' => '<aside id="%1$s" class="widget clearfix">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
@@ -136,7 +139,8 @@ function ar2_add_sidebars() {
for( $i = 1; $i < $footer_sidebars + 1; $i++ ) {
register_sidebar( array(
- 'name' => 'Footer Sidebar #' . $i,
+ 'name' => sprintf( __( 'Footer Sidebar #%s', 'ar2' ), $i ),
+ 'id' => 'footer-sidebar-' . $i,
'before_widget' => '<aside id="%1$s" class="widget clearfix">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
View
10 home.php
@@ -17,17 +17,19 @@
<?php ar2_render_zone( 'home' ) ?>
-<?php $sidebars = wp_get_sidebars_widgets(); ?>
-
+<?php if ( is_active_sidebar( 'Bottom Content #1' ) ) : ?>
<div class="bottom-sidebar" id="bottom-content-1" role="complementary">
- <?php if ( isset( $sidebars[ 'sidebar-3' ] ) && !dynamic_sidebar( 'Bottom Content #1' ) ) : ?>
+ <?php if ( !dynamic_sidebar( 'Bottom Content #1' ) ) : ?>
<?php endif; ?>
</div>
+<?php endif ?>
+<?php if ( is_active_sidebar( 'Bottom Content #2' ) ) : ?>
<div class="bottom-sidebar" id="bottom-content-2" role="complementary">
- <?php if ( isset( $sidebars[ 'sidebar-3' ] ) && !dynamic_sidebar( 'Bottom Content #2' ) ) : ?>
+ <?php if ( !dynamic_sidebar( 'Bottom Content #2' ) ) : ?>
<?php endif; ?>
</div>
+<?php endif ?>
<?php else: ?>
View
2  sidebar.php
@@ -5,7 +5,7 @@
<div id="primary" class="aside main-aside sidebar" role="complementary">
<?php ar2_above_sidebar() ?>
- <?php if ( !dynamic_sidebar( 'Primary Sidebar' ) ) : ?>
+ <?php if ( !dynamic_sidebar( 'primary-sidebar' ) ) : ?>
<aside id="text-static" class="widget clearfix">
<h3 class="widget-title"><?php _e( 'Welcome to Project AR2!', 'ar2' ) ?></h3>
Please sign in to comment.
Something went wrong with that request. Please try again.