From 00c9709fd9763542e848f6278db8ba26af5c9886 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 15 Oct 2018 23:46:42 +0200 Subject: Initial commit. --- inc/widgets.php | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 inc/widgets.php (limited to 'inc/widgets.php') diff --git a/inc/widgets.php b/inc/widgets.php new file mode 100644 index 0000000..fdd6611 --- /dev/null +++ b/inc/widgets.php @@ -0,0 +1,119 @@ + 6 ) : + // Four widgets per row if there are exactly four or more than six + $widget_classes .= ' col-md-3'; + elseif ( 6 == $widget_count ) : + // If two widgets are published + $widget_classes .= ' col-md-2'; + elseif ( $widget_count >= 3 ) : + // Three widgets per row if there's three or more widgets + $widget_classes .= ' col-md-4'; + elseif ( 2 == $widget_count ) : + // If two widgets are published + $widget_classes .= ' col-md-6'; + elseif ( 1 == $widget_count ) : + // If just on widget is active + $widget_classes .= ' col-md-12'; + endif; + return $widget_classes; + endif; + } +} + +add_action( 'widgets_init', 'understrap_widgets_init' ); + +if ( ! function_exists( 'understrap_widgets_init' ) ) { + /** + * Initializes themes widgets. + */ + function understrap_widgets_init() { + register_sidebar( array( + 'name' => __( 'Right Sidebar', 'understrap' ), + 'id' => 'right-sidebar', + 'description' => __( 'Right sidebar widget area', 'understrap' ), + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + + register_sidebar( array( + 'name' => __( 'Left Sidebar', 'understrap' ), + 'id' => 'left-sidebar', + 'description' => __( 'Left sidebar widget area', 'understrap' ), + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + + register_sidebar( array( + 'name' => __( 'Hero Slider', 'understrap' ), + 'id' => 'hero', + 'description' => __( 'Hero slider area. Place two or more widgets here and they will slide!', 'understrap' ), + 'before_widget' => '', + 'before_title' => '', + 'after_title' => '', + ) ); + + register_sidebar( array( + 'name' => __( 'Hero Canvas', 'understrap' ), + 'id' => 'herocanvas', + 'description' => __( 'Full size canvas hero area for Bootstrap and other custom HTML markup', 'understrap' ), + 'before_widget' => '', + 'after_widget' => '', + 'before_title' => '', + 'after_title' => '', + ) ); + + register_sidebar( array( + 'name' => __( 'Top Full', 'understrap' ), + 'id' => 'statichero', + 'description' => __( 'Full top widget with dynamic grid', 'understrap' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) ); + + register_sidebar( array( + 'name' => __( 'Footer Full', 'understrap' ), + 'id' => 'footerfull', + 'description' => __( 'Full sized footer widget with dynamic grid', 'understrap' ), + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + + } +} // endif function_exists( 'understrap_widgets_init' ). -- cgit v1.2.3