Skip to content

Commit

Permalink
fix: admin-settings-compatibility-with-multiple-themes
Browse files Browse the repository at this point in the history
-- Fixes --
1. Sales count down modules templates ui issue in shop page.
2. Shopping cart modules product remove option ui issue.
3. Direct checkout button rendering issue on shop and single page.
4. Direct checkout button ui rendering issue on shop page.
5. Sales count down modules ui rendering issue on shop page.
6. Stock bar modules ui rendering issue on shop page.

Issue: #320
  • Loading branch information
MdAsifHossainNadim committed Nov 15, 2023
1 parent fce0ee3 commit 1053670
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 8 deletions.
21 changes: 21 additions & 0 deletions includes/modules/countdown-timer/assets/scripts/wpbs-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,24 @@ font-family: "Merienda" !important;
}

/* layout2 styles end */

@media (max-width: 430px) {
.sgsb-countdown-timer-items {
align-items: center;

.sgsb-countdown-timer-item {
font-size: 6px;
padding-top: 7px;

&.ct-layout-1 {
width: 37px;
height: 40px;
}

&.ct-layout-2 {
width: 38px;
height: 38px;
}
}
}
}
33 changes: 30 additions & 3 deletions includes/modules/countdown-timer/includes/class-enqueue-script.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,46 @@ private function inline_styles() {
$border_color = sgsb_find_option_setting( $settings, 'border_color', '#cccccc' );
$heading_text_color = sgsb_find_option_setting( $settings, 'heading_text_color', '#000000' );
$selected_theme = sgsb_find_option_setting( $settings, 'selected_theme', 'ct-custom' );
if ( 'ct-custom' === $selected_theme ) {

// Check current theme status.
$theme = wp_get_theme();
$is_twenty_one_theme = ! empty( $theme->name ) ? $theme->name === 'Twenty Twenty-One' : false;
$is_twenty_four_theme = ! empty( $theme->name ) ? $theme->name === 'Twenty Twenty-Four' : false;

if ( 'ct-layout-1' === $selected_theme ) {
$custom_css = "
.sgsb-countdown-timer.ct-custom{
.sgsb-countdown-timer.ct-custom {
border-color: {$border_color};
background-color: {$widget_bg_color};
}
.sgsb-countdown-timer-heading.ct-custom{
.sgsb-countdown-timer-heading.ct-custom {
color: {$heading_text_color};
}
";
} else {
$custom_css = '';
}

if ( $is_twenty_one_theme ) {
$custom_css .= '
.sgsb-countdown-timer {
margin-top: 18px;
}
';
}

if ( $is_twenty_four_theme ) {
$custom_css .= '
.sgsb-countdown-timer {
padding-left: 0px;
padding-right: 0px;
}
.sgsb-countdown-timer-item {
height: 40px;
}
';
}

wp_add_inline_style( 'sgsb-cd-timer-custom-style', $custom_css );
}
}
45 changes: 40 additions & 5 deletions includes/modules/direct-checkout/includes/class-enqueue-script.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,13 @@ private function dc_button_inline_styles() {
$font_size = sgsb_find_option_setting( $settings, 'font_size', '16' );
$button_border_radius = sgsb_find_option_setting( $settings, 'button_border_radius', '5' );

$theme = wp_get_theme();
$is_avada_theme = ! empty( $theme->name ) ? $theme->name === 'Avada' : false;
$is_ocean_wp_theme = ! empty( $theme->name ) ? $theme->name === 'OceanWP' : false;
$button_margin = $is_ocean_wp_theme ? '20px 0 0' : '0 0 10px 10px';
$theme = wp_get_theme();
$is_avada_theme = ! empty( $theme->name ) ? $theme->name === 'Avada' : false;
$is_ocean_wp_theme = ! empty( $theme->name ) ? $theme->name === 'OceanWP' : false;
$is_elementor_theme = ! empty( $theme->name ) ? $theme->name === 'Hello Elementor' : false;
$is_twenty_one_theme = ! empty( $theme->name ) ? $theme->name === 'Twenty Twenty-One' : false;
$is_twenty_four_theme = ! empty( $theme->name ) ? $theme->name === 'Twenty Twenty-Four' : false;
$button_margin = $is_ocean_wp_theme ? '20px 0 0' : '0 0 10px 10px';

$custom_css = "
.button.product_type_simple.sgsb_buy_now_button,
Expand All @@ -122,7 +125,7 @@ private function dc_button_inline_styles() {
border-radius: {$button_border_radius}px;
font-size: {$font_size}px !important;
color: {$text_color} !important;
margin: {$button_margin} !important;
margin: {$button_margin};
} ";

if ( $is_avada_theme ) {
Expand Down Expand Up @@ -150,6 +153,38 @@ private function dc_button_inline_styles() {
';
}

if ( $is_elementor_theme ) {
$custom_css .= '
.sgsb-fly-cart-table .product-remove a {
margin-right: 0 !important;
}
';
}

if ( $is_twenty_four_theme ) {
$custom_css .= '
.button.sgsb_buy_now_button {
display: block;
padding-left: 1rem;
padding-top: 0.6rem;
padding-right: 1rem;
padding-bottom: 0.6rem;
margin: 0 auto !important;
}
.button.sgsb_buy_now_button_product_page {
float: none !important;
}
';
}

if ( $is_twenty_one_theme ) {
$custom_css .= '
.button.sgsb_buy_now_button {
margin: 16px 0 0 0 !important;
}
';
}

wp_add_inline_style( 'sgsb-button-style', $custom_css );
}
}
11 changes: 11 additions & 0 deletions includes/modules/stock-bar/includes/class-enqueue-script.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ private function inline_styles() {
$fg_color = sgsb_find_option_setting( $settings, 'stockbar_fg_color', '#0875ff' );
$border_color = sgsb_find_option_setting( $settings, 'stockbar_border_color', '#dde6f9' );

$theme = wp_get_theme();
$is_twenty_one_theme = ! empty( $theme->name ) ? $theme->name === 'Twenty Twenty-One' : false;

$custom_css = "
.sgsb-stock-progress-bar-section {
border: 2px solid {$border_color};
Expand All @@ -112,6 +115,14 @@ private function inline_styles() {
}
";

if ( $is_twenty_one_theme ) {
$custom_css .= '
.sgsb-stock-counter-and-bar {
margin-top: 18px;
}
';
}

wp_add_inline_style( 'sgsb-stock-cd-custom-style', $custom_css );
}
}

0 comments on commit 1053670

Please sign in to comment.