Skip to content

Commit

Permalink
Merge branch 'release/1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Dec 28, 2017
2 parents 17756c6 + 636b749 commit 893cd33
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 35 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
== Changelog ==

= 1.4 - 28 December 2017 =
* Added WooCommerce sidebar widget area and theme setting.

= 1.3.25 - 14 December 2017 =
* Resolved WooCommerce PayPal logo issue impacting child themes.

Expand Down
12 changes: 12 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@ function siteorigin_north_widgets_init() {
'after_title' => '</h2>',
) );

if ( function_exists( 'is_woocommerce' ) ) {
register_sidebar( array(
'name' => esc_html__( 'Shop Sidebar', 'siteorigin-north' ),
'id' => 'sidebar-shop',
'description' => esc_html__( 'Displays on WooCommerce pages.', 'siteorigin-north' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h3>',
) );
}

}
endif;
add_action( 'widgets_init', 'siteorigin_north_widgets_init' );
Expand Down
10 changes: 10 additions & 0 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,19 @@ function siteorigin_north_body_classes( $classes ) {
}

if ( class_exists( 'Woocommerce' ) ) {

if ( ! siteorigin_setting( 'masthead_text_above' ) && ! is_active_sidebar( 'topbar-sidebar' ) && ! is_store_notice_showing() ) {
$classes[] = 'no-topbar';
}

if ( siteorigin_setting( 'woocommerce_sidebar_position' ) == 'left' && ( is_woocommerce() || is_cart() || is_checkout() ) ) {
$classes[] = 'layout-wc-sidebar-left';
}

if ( siteorigin_setting( 'woocommerce_sidebar_position' ) == 'none' && ( is_woocommerce() || is_cart() || is_checkout() ) ) {
$classes[] = 'no-active-wc-sidebar';
}

} elseif ( ! siteorigin_setting( 'masthead_text_above' ) && ! is_active_sidebar( 'topbar-sidebar' ) ) {
$classes[] = 'no-topbar';
}
Expand Down
33 changes: 22 additions & 11 deletions inc/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,31 @@ function siteorigin_north_woocommerce_settings( $settings ) {
),

'display_cart' => array(
'type' => 'checkbox',
'label' => esc_html__( 'Display Cart', 'siteorigin-north' ),
'type' => 'checkbox',
'label' => esc_html__( 'Display Cart', 'siteorigin-north' ),
'description' => esc_html__( 'Display WooCommerce cart in the main menu.', 'siteorigin-north' ),
),

'display_checkout_cart' => array(
'type' => 'checkbox',
'label' => esc_html__( 'Display Cart in Checkout', 'siteorigin-north' ),
'type' => 'checkbox',
'label' => esc_html__( 'Display Cart in Checkout', 'siteorigin-north' ),
'description' => esc_html__( 'Display WooCommerce cart in the main menu on cart and checkout page.', 'siteorigin-north' ),
),

'display_quick_view' => array(
'type' => 'checkbox',
'label' => esc_html__( 'Display Quick View button', 'siteorigin-north' ),
)
'type' => 'checkbox',
'label' => esc_html__( 'Display Quick View button', 'siteorigin-north' ),
),

'sidebar_position' => array(
'type' => 'select',
'label' => esc_html__( 'Shop Sidebar Position', 'siteorigin-north' ),
'options' => array(
'left' => esc_html__( 'Left', 'siteorigin-north' ),
'right' => esc_html__( 'Right', 'siteorigin-north' ),
'none' => esc_html__( 'None', 'siteorigin-north' ),
),
),

)
)
Expand Down Expand Up @@ -1232,10 +1242,11 @@ function siteorigin_north_settings_defaults( $defaults ){
$defaults['footer_top_margin'] = '30px';

// WooCommerce defaults
$defaults['woocommerce_archive_columns'] = 3;
$defaults['woocommerce_display_cart'] = true;
$defaults['woocommerce_display_checkout_cart'] = false;
$defaults['woocommerce_display_quick_view'] = false;
$defaults['woocommerce_archive_columns'] = 3;
$defaults['woocommerce_display_cart'] = true;
$defaults['woocommerce_display_checkout_cart'] = false;
$defaults['woocommerce_display_quick_view'] = false;
$defaults['woocommerce_sidebar_position'] = 'right';

return $defaults;
}
Expand Down
9 changes: 5 additions & 4 deletions sass/layout/_content-sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@
.site-content .widget-area {
float: right;
overflow: hidden;
width: $size__site-sidebar;
padding-left: 40px;
width: $size__site-sidebar;
}

.site-footer {
clear: both;
width: $size__site-main;
min-width: 1060px;
width: $size__site-main;

body.responsive & {
min-width: 0;
}
}

.no-active-sidebar {
.no-active-sidebar:not(.woocommerce):not(.woocommerce-page),
.no-active-wc-sidebar {

.content-area {
float: none;
Expand All @@ -35,7 +37,6 @@
.site-main {
margin: 0;
}

}

@media (max-width: 600px) {
Expand Down
9 changes: 5 additions & 4 deletions sass/layout/_sidebar-content.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.layout-sidebar-left {
.layout-sidebar-left:not(.woocommerce):not(.woocommerce-page),
.layout-wc-sidebar-left {

.content-area {
float: right;
Expand All @@ -13,8 +14,8 @@
.site-content .widget-area {
float: left;
overflow: hidden;
padding-left: 0;
padding-right: 40px;
padding-left: 0;
width: $size__site-sidebar;
}

Expand All @@ -23,12 +24,12 @@
width: $size__site-main;
}

&.no-active-sidebar {
&.no-active-sidebar:not(.woocommerce):not(.woocommerce-page) {

.content-area {
float: none;
width: auto;
margin: 0;
width: auto;
}

.site-main {
Expand Down
20 changes: 20 additions & 0 deletions sidebar-shop.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* The sidebar for WooCommerce shop pages.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package siteorigin-north
* @license GPL 2.0
*/

if ( siteorigin_setting( 'woocommerce_sidebar_position' ) == 'none' ) return;
?>

<div id="secondary" class="widget-area" aria-label="<?php esc_attr_e( 'Shop Sidebar', 'siteorigin-north' ); ?>">
<?php if ( is_active_sidebar( 'sidebar-shop' ) ) {
dynamic_sidebar( 'sidebar-shop' );
} else {
dynamic_sidebar( 'main-sidebar' );
} ?>
</div><!-- #secondary -->
38 changes: 23 additions & 15 deletions style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
</main><!-- #main -->
</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_sidebar( 'shop' ); ?>
<?php get_footer(); ?>

0 comments on commit 893cd33

Please sign in to comment.