register left-right templates, WP coding standards
This commit is contained in:
parent
85a6d42c00
commit
108222b383
|
@ -5,48 +5,58 @@
|
||||||
*
|
*
|
||||||
* @package understrap
|
* @package understrap
|
||||||
*/
|
*/
|
||||||
if ( ! function_exists ( 'understrap_widgets_init' ) ) {
|
if ( ! function_exists( 'understrap_widgets_init' ) ) {
|
||||||
function understrap_widgets_init() {
|
function understrap_widgets_init() {
|
||||||
register_sidebar( array(
|
register_sidebar( array(
|
||||||
'name' => __( 'Sidebar', 'understrap' ),
|
'name' => __( 'Right Sidebar', 'understrap' ),
|
||||||
'id' => 'sidebar-1',
|
'id' => 'right-sidebar',
|
||||||
'description' => 'Sidebar widget area',
|
'description' => 'Right sidebar widget area',
|
||||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||||
'after_widget' => '</aside>',
|
'after_widget' => '</aside>',
|
||||||
'before_title' => '<h3 class="widget-title">',
|
'before_title' => '<h3 class="widget-title">',
|
||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
register_sidebar( array(
|
register_sidebar( array(
|
||||||
'name' => __( 'Hero Slider', 'understrap' ),
|
'name' => __( 'Left Sidebar', 'understrap' ),
|
||||||
'id' => 'hero',
|
'id' => 'left-sidebar',
|
||||||
'description' => 'Hero slider area. Place two or more widgets here and they will slide!',
|
'description' => 'Left sidebar widget area',
|
||||||
'before_widget' => '<div class="item">',
|
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||||
'after_widget' => '</div>',
|
'after_widget' => '</aside>',
|
||||||
'before_title' => '',
|
'before_title' => '<h3 class="widget-title">',
|
||||||
'after_title' => '',
|
'after_title' => '</h3>',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
register_sidebar( array(
|
register_sidebar( array(
|
||||||
'name' => __( 'Hero Static', 'understrap' ),
|
'name' => __( 'Hero Slider', 'understrap' ),
|
||||||
'id' => 'statichero',
|
'id' => 'hero',
|
||||||
'description' => 'Static Hero widget. no slider functionallity',
|
'description' => 'Hero slider area. Place two or more widgets here and they will slide!',
|
||||||
'before_widget' => '',
|
'before_widget' => '<div class="item">',
|
||||||
'after_widget' => '',
|
'after_widget' => '</div>',
|
||||||
'before_title' => '',
|
'before_title' => '',
|
||||||
'after_title' => '',
|
'after_title' => '',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
register_sidebar( array(
|
register_sidebar( array(
|
||||||
'name' => __( 'Footer Full', 'understrap' ),
|
'name' => __( 'Hero Static', 'understrap' ),
|
||||||
'id' => 'footerfull',
|
'id' => 'statichero',
|
||||||
'description' => 'Widget area below main content and above footer',
|
'description' => 'Static Hero widget. no slider functionallity',
|
||||||
'before_widget' => '',
|
'before_widget' => '',
|
||||||
'after_widget' => '',
|
'after_widget' => '',
|
||||||
'before_title' => '',
|
'before_title' => '',
|
||||||
'after_title' => '',
|
'after_title' => '',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
}
|
register_sidebar( array(
|
||||||
|
'name' => __( 'Footer Full', 'understrap' ),
|
||||||
|
'id' => 'footerfull',
|
||||||
|
'description' => 'Widget area below main content and above footer',
|
||||||
|
'before_widget' => '',
|
||||||
|
'after_widget' => '',
|
||||||
|
'before_title' => '',
|
||||||
|
'after_title' => '',
|
||||||
|
) );
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add_action( 'widgets_init', 'understrap_widgets_init' );
|
add_action( 'widgets_init', 'understrap_widgets_init' );
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The sidebar containing the main widget area.
|
||||||
|
*
|
||||||
|
* @package understrap
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! is_active_sidebar( 'right-sidebar' ) || ! is_active_sidebar( 'right-sidebar' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// when both sidebars turned one, reduce col size to 3 from 4.
|
||||||
|
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( 'both' === $sidebar_pos ): ?>
|
||||||
|
<div class="col-md-3 widget-area" id="secondary" role="complementary">
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="col-md-4 widget-area" id="secondary" role="complementary">
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php dynamic_sidebar( ); ?>
|
||||||
|
|
||||||
|
</div><!-- #secondary -->
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The sidebar containing the main widget area.
|
||||||
|
*
|
||||||
|
* @package understrap
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! is_active_sidebar( 'right-sidebar' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// when both sidebars turned one, reduce col size to 3 from 4.
|
||||||
|
$sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( 'both' === $sidebar_pos ): ?>
|
||||||
|
<div class="col-md-3 widget-area" id="secondary" role="complementary">
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="col-md-4 widget-area" id="secondary" role="complementary">
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php dynamic_sidebar( 'right-sidebar' ); ?>
|
||||||
|
|
||||||
|
</div><!-- #secondary -->
|
Reference in New Issue