Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Split the subsidiary sidebar into three sidebars

This commit splits the subsidiary sidebar into three different. The name
has also been renamed to 'Footer Area One' and so on to make it easier
to understand

The theme auto detects if there's one, two or three active sidebars and
adjust the width after that. Just like in Twentyeleven
  • Loading branch information...
commit b09989d4eaf2ae29c693009210e4f5517605590f 1 parent c48debd
@jayj authored
View
8 footer.php
@@ -36,7 +36,13 @@
<?php do_atomic( 'footer' ); // cakifo_footer ?>
- <?php get_sidebar( 'subsidiary' ); // Loads the sidebar-subsidiary.php template ?>
+ <?php
+ /* A sidebar in the footer? Yep. You can can customize
+ * your footer with three columns of widgets.
+ */
+ if ( ! is_404() )
+ get_sidebar( 'subsidiary' );
+ ?>
</div> <!-- .wrap -->
View
2  functions.php
@@ -69,7 +69,7 @@ function cakifo_theme_setup() {
//add_theme_support( 'cleaner-caption' );
/* Add theme support for theme functions */
- add_theme_support( 'cakifo-sidebars', array( 'primary', 'secondary', 'subsidiary', 'after-single', 'after-singular', 'error-page' ) );
+ add_theme_support( 'cakifo-sidebars', array( 'primary', 'secondary', 'subsidiary', 'subsidiary-two', 'subsidiary-three', 'after-single', 'after-singular', 'error-page' ) );
add_theme_support( 'cakifo-shortcodes' );
add_theme_support( 'cakifo-colorbox' );
add_theme_support( 'cakifo-twitter-button' );
View
44 functions/sidebars.php
@@ -58,11 +58,33 @@ function cakifo_register_sidebars() {
'after_title' => '</h3>'
);
- /* Set up the subsidiary sidebar arguments */
- $subsidiary = array(
+ /* Set up the first footer sidebar arguments */
+ $subsidiary_one = array(
'id' => 'subsidiary',
- 'name' => _x( 'Subsidiary', 'sidebar name', 'cakifo' ),
- 'description' => __( 'A widget area loaded in the footer of the site.', 'cakifo' ),
+ 'name' => _x( 'Footer Area One', 'sidebar name', 'cakifo' ),
+ 'description' => __( 'An optional widget area for your site footer.', 'cakifo' ),
+ 'before_widget' => '<aside id="%1$s" class="widget %2$s widget-%2$s">',
+ 'after_widget' => '</aside>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>'
+ );
+
+ /* Set up the second footer sidebar arguments */
+ $subsidiary_two = array(
+ 'id' => 'subsidiary-two',
+ 'name' => _x( 'Footer Area Two', 'sidebar name', 'cakifo' ),
+ 'description' => __( 'An optional widget area for your site footer.', 'cakifo' ),
+ 'before_widget' => '<aside id="%1$s" class="widget %2$s widget-%2$s">',
+ 'after_widget' => '</aside>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>'
+ );
+
+ /* Set up the third footer sidebar arguments */
+ $subsidiary_three = array(
+ 'id' => 'subsidiary-three',
+ 'name' => _x( 'Footer Area Three', 'sidebar name', 'cakifo' ),
+ 'description' => __( 'An optional widget area for your site footer.', 'cakifo' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s widget-%2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
@@ -143,9 +165,17 @@ function cakifo_register_sidebars() {
if ( in_array( 'secondary', $sidebars[0] ) )
register_sidebar( $secondary );
- /* Register the subsidiary sidebar */
- if ( in_array( 'subsidiary', $sidebars[0] ) )
- register_sidebar( $subsidiary );
+ /* Register the first footer sidebar */
+ if ( in_array( 'subsidiary', $sidebars[0] ) || in_array( 'footer', $sidebars[0] ) )
+ register_sidebar( $subsidiary_one );
+
+ /* Register the second footer sidebar */
+ if ( in_array( 'subsidiary-two', $sidebars[0] ) || in_array( 'footer-two', $sidebars[0] ) )
+ register_sidebar( $subsidiary_two );
+
+ /* Register the third footer sidebar */
+ if ( in_array( 'subsidiary-three', $sidebars[0] ) || in_array( 'footer-three', $sidebars[0] ) )
+ register_sidebar( $subsidiary_three );
/* Register the header sidebar */
if ( in_array( 'header', $sidebars[0] ) )
View
66 sidebar-subsidiary.php
@@ -9,22 +9,72 @@
* @subpackage Template
*/
-if ( is_active_sidebar( 'subsidiary' ) ) : ?>
+/* The footer widget area is triggered if any of the areas
+ * have widgets. So let's check that first.
+ *
+ * If none of the sidebars have widgets, then let's bail early.
+ */
+$subsidiary_active = is_active_sidebar( 'subsidiary' );
+$subsidiary_two_active = is_active_sidebar( 'subsidiary-two' );
+$subsidiary_three_active = is_active_sidebar( 'subsidiary-three' );
+
+if ( ! $subsidiary_active && ! $subsidiary_two_active && ! $subsidiary_three_active )
+ return;
+
+ // If we get this far, we have widgets. Let's count the number of footer sidebars to enable dynamic classes for the footer
+ $count = 0;
+
+ if ( $subsidiary_active )
+ $count++;
+
+ if ( $subsidiary_two_active )
+ $count++;
- <div class="clear"></div>
+ if ( $subsidiary_three_active )
+ $count++;
- <?php do_atomic( 'before_sidebar_subsidiary' ); // cakifo_before_sidebar_subsidiary ?>
+ $class = '';
- <div id="sidebar-subsidiary">
+ switch ( $count ) {
+ case '1':
+ $class = 'one-col';
+ break;
+ case '2':
+ $class = 'two-col';
+ break;
+ case '3':
+ $class = 'three-col';
+ break;
+ }
+
+?>
+
+<?php do_atomic( 'before_sidebar_subsidiary' ); // cakifo_before_sidebar_subsidiary ?>
+
+ <div id="sidebar-subsidiary" class="<?php echo esc_attr( $class ); ?> clearfix">
<?php do_atomic( 'open_sidebar_subsidiary' ); // cakifo_open_sidebar_subsidiary ?>
- <?php dynamic_sidebar( 'subsidiary' ); ?>
+ <?php if ( $subsidiary_active ) : ?>
+ <div id="first-footer-col" class="widget-area" role="complementary">
+ <?php dynamic_sidebar( 'subsidiary' ); ?>
+ </div><!-- #first-footer-col.widget-area -->
+ <?php endif; ?>
+
+ <?php if ( $subsidiary_two_active ) : ?>
+ <div id="second-footer-col" class="widget-area" role="complementary">
+ <?php dynamic_sidebar( 'subsidiary-two' ); ?>
+ </div><!-- #second-footer-col.widget-area -->
+ <?php endif; ?>
+
+ <?php if ( $subsidiary_three_active ) : ?>
+ <div id="third-footer-col" class="widget-area" role="complementary">
+ <?php dynamic_sidebar( 'subsidiary-three' ); ?>
+ </div><!-- #third-footer-col.widget-area -->
+ <?php endif; ?>
<?php do_atomic( 'close_sidebar_subsidiary' ); // cakifo_close_sidebar_subsidiary ?>
</div> <!-- #sidebar-subsidiary -->
- <?php do_atomic( 'after_sidebar_subsidiary' ); // cakifo_after_sidebar_subsidiary ?>
-
-<?php endif; ?>
+<?php do_atomic( 'after_sidebar_subsidiary' ); // cakifo_after_sidebar_subsidiary ?>
View
40 style.dev.css
@@ -1919,7 +1919,8 @@ img.alignright {
}
.recent-posts-meta,
-.headline-meta {
+.headline-meta,
+.rss-date {
color: #999;
display: block;
font-size: 12px;
@@ -2173,6 +2174,12 @@ img.alignright {
text-align: center;
}
+ #sidebar-subsidiary #wp-calendar th,
+ #sidebar-subsidiary #wp-calendar tr td {
+ font-size: 12px;
+ padding: 0px 0px;
+ }
+
/**
* Related Posts widget
*/
@@ -2259,28 +2266,33 @@ img.alignright {
text-align: right;
}
-/* Footer widgets */
+/* Footer sidebar */
#sidebar-subsidiary {
clear: both;
- margin-top: 20px;
- overflow: hidden;
+ padding-top: 20px;
}
-#sidebar-subsidiary .widget {
+/* Two Footer Widget Areas */
+#sidebar-subsidiary.two-col .widget-area {
float: left;
- width: 220px;
- margin-right: 20px;
+ margin-right: 3.7%;
+ width: 48.1%;
}
-#sidebar-subsidiary .widget:nth-child(4n) {
- margin-right: 0 !important;
+#sidebar-subsidiary.two-col .widget-area + .widget-area {
+ margin-right: 0;
}
- /* IE fixes */
- .oldie #sidebar-subsidiary .widget {
- margin-right: 10px;
- margin-left: 5px;
- }
+/* Three Footer Widget Areas */
+#sidebar-subsidiary.three-col .widget-area {
+ float: left;
+ margin-right: 3.7%;
+ width: 30.8%;
+}
+
+#sidebar-subsidiary.three-col .widget-area + .widget-area + .widget-area {
+ margin-right: 0;
+}
/**
* Comments
Please sign in to comment.
Something went wrong with that request. Please try again.