Footer widget tweaks

* Set default rows to 1
* Rename storefront_footer_widget_regions to
storefront_footer_widget_columns
* Tweak footer widget region names / descriptions based on number of
rows
This commit is contained in:
James Koster 2017-01-19 14:41:42 +00:00
parent 6a076c285d
commit df07999d48
3 changed files with 15 additions and 6 deletions

View file

@ -5,6 +5,7 @@
* **Fix** - Only make the order review on checkout sticky of the address column is tall enough to make it worthwhile.
* **Tweak** - Improved the Bookings calendar styles.
* **Dev** - Added actions; `storefront_jetpack_infinite_scroll_before`, `storefront_jetpack_infinite_scroll_after`, `storefront_jetpack_product_infinite_scroll_before` and `storefront_jetpack_product_infinite_scroll_after`.
* **Dev** - Added filters; `storefront_footer_widget_rows` and `storefront_footer_widget_columns` to easily control the number of widget rows / columns in the footer.
### *2017.01.17* - 2.1.7
* **Tweak** - [WooCommerce 2.7] - Ensure all checkboxes function correctly with new markup.

View file

@ -142,18 +142,26 @@ if ( ! class_exists( 'Storefront' ) ) :
'description' => __( 'Widgets added to this region will appear beneath the header and above the main content.', 'storefront' ),
);
$rows = intval( apply_filters( 'storefront_footer_widget_rows', 2 ) );
$regions = intval( apply_filters( 'storefront_footer_widget_regions', 4 ) );
$rows = intval( apply_filters( 'storefront_footer_widget_rows', 1 ) );
$regions = intval( apply_filters( 'storefront_footer_widget_columns', 4 ) );
for ( $row = 1; $row <= $rows; $row++ ) {
for ( $region = 1; $region <= $regions; $region++ ) {
$footer_n = $region + $regions * ( $row - 1 ); // Defines footer sidebar ID.
$footer = sprintf( 'footer_%d', $footer_n );
if ( 1 == $rows ) {
$footer_region_name = sprintf( __( 'Footer Column %1$d', 'storefront' ), $region );
$footer_region_description = sprintf( __( 'Widgets added here will appear in column %1$d of the footer.', 'storefront' ), $region );
} else {
$footer_region_name = sprintf( __( 'Footer Row %1$d - Column %2$d', 'storefront' ), $row, $region );
$footer_region_description = sprintf( __( 'Widgets added here will appear in column %1$d of footer row %2$d.', 'storefront' ), $region, $row );
}
$sidebar_args[ $footer ] = array(
'name' => sprintf( __( 'Footer Row%1$d Column%2$d', 'storefront' ), $row, $region ),
'name' => $footer_region_name,
'id' => sprintf( 'footer-%d', $footer_n ),
'description' => sprintf( __( 'Widgetized Footer Row%1$d Column%2$d.', 'storefront' ), $row, $region )
'description' => $footer_region_description,
);
}
}

View file

@ -79,8 +79,8 @@ if ( ! function_exists( 'storefront_footer_widgets' ) ) {
* @return void
*/
function storefront_footer_widgets() {
$rows = intval( apply_filters( 'storefront_footer_widget_rows', 2 ) );
$regions = intval( apply_filters( 'storefront_footer_widget_regions', 4 ) );
$rows = intval( apply_filters( 'storefront_footer_widget_rows', 1 ) );
$regions = intval( apply_filters( 'storefront_footer_widget_columns', 4 ) );
for ( $row = 1; $row <= $rows; $row++ ) :