Page Builder: PageLayer – Drag and Drop website builder - Version 1.7.1

Version Description

(Sep 07, 2022) = * [Feature] Added Customizer settings for WooCommerce. Now you can easily customize your WooCommerce Store.

Download this release

Release Info

Developer pagelayer
Plugin Icon 128x128 Page Builder: PageLayer – Drag and Drop website builder
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7.0 to 1.7.1

css/customizer.css CHANGED
@@ -30,6 +30,10 @@ content: "\f347";
30
  font-weight: 400;
31
  }
32
 
 
 
 
 
33
  /* pagelayer padding controls*/
34
  .pagelayer-control-padding{
35
  display: flex;
@@ -546,4 +550,120 @@ height: 100% !important;
546
 
547
  .pagelayer-accordion-tab{
548
  cursor: pointer;
549
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  font-weight: 400;
31
  }
32
 
33
+ .pagelayer-customize-control-title{
34
+ display:flex;
35
+ }
36
+
37
  /* pagelayer padding controls*/
38
  .pagelayer-control-padding{
39
  display: flex;
550
 
551
  .pagelayer-accordion-tab{
552
  cursor: pointer;
553
+ }
554
+
555
+ /* pagelayer controls*/
556
+ .pagelayer-customize-inside-control-row{
557
+ display:flex;
558
+ }
559
+ input[type="radio"].pagelayer-customize-radio{
560
+ font-size: 14px;
561
+ flex: 1 !important;
562
+ width: 100% !important;
563
+ height: 2.6em !important;
564
+ -webkit-appearance: none !important;
565
+ -moz-appearance: none !important;
566
+ appearance: none !important;
567
+ border: 1px solid #fff!important;
568
+ border-radius: 2px !important;
569
+ margin:0 !important;
570
+ box-shadow: none !important;
571
+ }
572
+
573
+ input[type="radio"].pagelayer-customize-radio:before{
574
+ content: attr(data-label) !important;
575
+ background: #fff;
576
+ color: #000;
577
+ width: calc(100% - 4px);
578
+ height: calc(100% - 4px);
579
+ margin: 2px;
580
+ display: flex;
581
+ align-items: center;
582
+ justify-content: center;
583
+ border-radius: 2px;
584
+ font-weight: 600;
585
+ }
586
+
587
+ input[type="radio"].pagelayer-customize-radio:hover:before{
588
+ color: #137dc5;
589
+ }
590
+
591
+ input[type=checkbox].pagelayer-customize-checkbox:checked,
592
+ input[type="radio"].pagelayer-customize-radio:checked:before{
593
+ background-color: #137dc5;
594
+ border-color: #137dc5;
595
+ color: #fff ;
596
+ }
597
+
598
+ .pagelayer-customize-inside-control-row > label{
599
+ flex:1;
600
+ }
601
+
602
+ input[type=checkbox].pagelayer-customize-checkbox{
603
+ font-size: 14px !important;
604
+ -webkit-appearance: none;
605
+ -moz-appearance: none;
606
+ appearance: none;
607
+ width: 3.5em !important;
608
+ height: 1.7em;
609
+ background: #ddd;
610
+ border-radius: 3em;
611
+ position: relative;
612
+ cursor: pointer;
613
+ outline: none;
614
+ -webkit-transition: all .2s ease-in-out;
615
+ transition: all .2s ease-in-out;
616
+ margin:0;
617
+ }
618
+
619
+ input[type=checkbox].pagelayer-customize-checkbox:before{
620
+ position: absolute;
621
+ content: "" !important;
622
+ width: 1.5em !important;
623
+ height: 1.5em !important;
624
+ border-radius: 50% !important;
625
+ background: #fff;
626
+ -webkit-box-shadow: 0 0 0.25em rgb(0 0 0 / 30%);
627
+ box-shadow: 0 0 0.25em rgb(0 0 0 / 30%);
628
+ -webkit-transform: scale(.7);
629
+ transform: scale(.7);
630
+ left: 0;
631
+ -webkit-transition: all .2s ease-in-out;
632
+ transition: all .2s ease-in-out;
633
+ display: flex;
634
+ align-items: center;
635
+ justify-content: center;
636
+ }
637
+
638
+ input[type=checkbox].pagelayer-customize-checkbox:checked:before{
639
+ left: calc(100% - 1.5em);
640
+ margin: 0;
641
+ }
642
+ /* pagelayer controls end*/
643
+ /* pagelayer slider*/
644
+ .pagelayer-slider-custom-control .customize-control-title{
645
+ display:inline-block;
646
+ }
647
+
648
+ .pagelayer-slider-custom-control input[type=number]::-webkit-inner-spin-button,
649
+ .pagelayer-slider-custom-control input[type=number]::-webkit-outer-spin-button {
650
+ -webkit-appearance: none;
651
+ margin: 0;
652
+ }
653
+
654
+ .pagelayer-slider-custom-control input[type=number] {
655
+ -moz-appearance: textfield;
656
+ width: 50px;
657
+ float: right;
658
+ }
659
+
660
+ .pagelayer-slider-custom-control input[type=range]{
661
+ width: calc(100% - 60px);
662
+ float: left;
663
+ margin: 7px 0;
664
+ }
665
+
666
+ .pagelayer-slider-custom-control .pagelayer-units{
667
+ float: right;
668
+ }
669
+ /* pagelayer slider end*/
init.php CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH')) exit;
5
 
6
  define('PAGELAYER_BASE', plugin_basename(PAGELAYER_FILE));
7
  define('PAGELAYER_PRO_BASE', 'pagelayer-pro/pagelayer-pro.php');
8
- define('PAGELAYER_VERSION', '1.7.0');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
@@ -238,7 +238,7 @@ function pagelayer_load_plugin(){
238
  include_once(PAGELAYER_DIR.'/main/customizer.php');
239
 
240
  if(class_exists('WooCommerce')){
241
- //include_once(PAGELAYER_DIR.'/main/woocommerce.php');
242
  }
243
 
244
  }
5
 
6
  define('PAGELAYER_BASE', plugin_basename(PAGELAYER_FILE));
7
  define('PAGELAYER_PRO_BASE', 'pagelayer-pro/pagelayer-pro.php');
8
+ define('PAGELAYER_VERSION', '1.7.1');
9
  define('PAGELAYER_DIR', dirname(PAGELAYER_FILE));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
238
  include_once(PAGELAYER_DIR.'/main/customizer.php');
239
 
240
  if(class_exists('WooCommerce')){
241
+ include_once(PAGELAYER_DIR.'/main/woocommerce.php');
242
  }
243
 
244
  }
js/combined.js CHANGED
@@ -366,6 +366,7 @@ function pagelayer_pl_tabs(jEle) {
366
  children.each(function(){
367
  var tEle = jQuery(this);
368
  var pl_id = tEle.attr('pagelayer-id');
 
369
  var title = tEle.attr('pagelayer-tab-title') || 'Tab';
370
  var func = "pagelayer_tab_show(this, '"+pl_id+"')";
371
 
366
  children.each(function(){
367
  var tEle = jQuery(this);
368
  var pl_id = tEle.attr('pagelayer-id');
369
+
370
  var title = tEle.attr('pagelayer-tab-title') || 'Tab';
371
  var func = "pagelayer_tab_show(this, '"+pl_id+"')";
372
 
js/customizer.js CHANGED
@@ -54,13 +54,6 @@ var pagelayer_fontHtmlArray = {};
54
  }
55
  }
56
 
57
- // Expand pagelayer setting handler
58
- api.panel('pagelayer_settings', function( panel ){
59
- panel.expanded.bind(function( isExpanding ){
60
- pagelayer_alpha_color_control_init(); // Init Alpha color
61
- });
62
- });
63
-
64
  // Expand pagelayer setting handler
65
  api.section('pagelayer_global_fonts_sec', function( section ){
66
  section.expanded.bind(function( isExpanding ){
@@ -87,6 +80,9 @@ var pagelayer_fontHtmlArray = {};
87
  */
88
  jQuery(document).ready( function(){
89
 
 
 
 
90
  var option = function(val, lang){
91
  var lang = lang || 'Default';
92
  return '<option value="'+val+'">'+lang+'</option>';
@@ -302,6 +298,9 @@ jQuery(document).ready( function(){
302
  // Global font list handler
303
  pagelayer_global_font_list_handler();
304
 
 
 
 
305
  });
306
 
307
  // Global font list handler
@@ -775,6 +774,7 @@ function pagelayer_control_padding_handler(jEle){
775
  function pagelayer_alpha_color_control_init(){
776
 
777
  var timeOut = 0;
 
778
  // Loop over each control and transform it into our color picker.
779
  jQuery( '.pagelayer-alpha-color-control' ).each( function() {
780
  // Scope the vars.
@@ -953,7 +953,7 @@ function pagelayer_alpha_color_control_init(){
953
  });
954
  }, timeOut);
955
 
956
- timeOut += 50;
957
  });
958
  }
959
 
@@ -1090,4 +1090,33 @@ function pagelayer_empty(mixed_var) {
1090
  }
1091
 
1092
  return false;
1093
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
  }
56
 
 
 
 
 
 
 
 
57
  // Expand pagelayer setting handler
58
  api.section('pagelayer_global_fonts_sec', function( section ){
59
  section.expanded.bind(function( isExpanding ){
80
  */
81
  jQuery(document).ready( function(){
82
 
83
+ // Create color setting
84
+ pagelayer_alpha_color_control_init();
85
+
86
  var option = function(val, lang){
87
  var lang = lang || 'Default';
88
  return '<option value="'+val+'">'+lang+'</option>';
298
  // Global font list handler
299
  pagelayer_global_font_list_handler();
300
 
301
+ // Slider handler
302
+ pagelayer_control_slider_handler();
303
+
304
  });
305
 
306
  // Global font list handler
774
  function pagelayer_alpha_color_control_init(){
775
 
776
  var timeOut = 0;
777
+
778
  // Loop over each control and transform it into our color picker.
779
  jQuery( '.pagelayer-alpha-color-control' ).each( function() {
780
  // Scope the vars.
953
  });
954
  }, timeOut);
955
 
956
+ timeOut += 20;
957
  });
958
  }
959
 
1090
  }
1091
 
1092
  return false;
1093
+ };
1094
+
1095
+ // Slider handler
1096
+ function pagelayer_control_slider_handler(){
1097
+
1098
+ // Change the value of the input field as the slider is moved
1099
+ jQuery('.pagelayer-slider').on('input', function(event, ui) {
1100
+ var sliderValue = jQuery(this).val();
1101
+ jQuery(this).parent().find('.customize-control-slider-value').val(sliderValue).trigger('input');
1102
+ });
1103
+
1104
+ // Update slider if the input field loses focus as it's most likely changed
1105
+ jQuery('.customize-control-slider-value').on('change', function() {
1106
+ var resetValue = jQuery(this).val();
1107
+ var slider = jQuery(this).parent().find('.pagelayer-slider');
1108
+ var sliderMinValue = parseInt(slider.attr('min'));
1109
+ var sliderMaxValue = parseInt(slider.attr('max'));
1110
+
1111
+ // Make sure our manual input value doesn't exceed the minimum & maxmium values
1112
+ if(resetValue < sliderMinValue) {
1113
+ resetValue = sliderMinValue;
1114
+ jQuery(this).val(resetValue).trigger('input');
1115
+ }
1116
+ if(resetValue > sliderMaxValue) {
1117
+ resetValue = sliderMaxValue;
1118
+ jQuery(this).val(resetValue).trigger('input');
1119
+ }
1120
+ slider.val(resetValue);
1121
+ });
1122
+ }
main/customizer-controls.php CHANGED
@@ -558,10 +558,149 @@ class Pagelayer_Font_Repeater_Control extends Pagelayer_Customize_Control {
558
  }
559
  }
560
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  /**
562
  * Switch sanitization
563
  *
564
- * @param string Switch value
565
  * @return integer Sanitized value
566
  */
567
  if ( ! function_exists( 'pagelayer_switch_sanitization' ) ) {
558
  }
559
  }
560
 
561
+ /**
562
+ * Customize control
563
+ *
564
+ */
565
+ class Pagelayer_Custom_Control extends Pagelayer_Customize_Control {
566
+
567
+ /**
568
+ * The type of control being rendered
569
+ */
570
+ public $type = 'pagelayer-customize-control';
571
+ public $responsive;
572
+ public $units;
573
+
574
+ /**
575
+ * Constructor
576
+ */
577
+ public function __construct( $manager, $id, $args = array(), $options = array() ) {
578
+ parent::__construct( $manager, $id, $args );
579
+ }
580
+
581
+ /**
582
+ * Render the control in the customizer
583
+ */
584
+ public function render_content() {
585
+
586
+ $units = $this->units;
587
+ $input_id = '_customize-input-' . $this->id;
588
+ $description_id = '_customize-description-' . $this->id;
589
+ $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : '';
590
+ switch ( $this->type ) {
591
+ case 'checkbox':
592
+ ?>
593
+ <span class="pagelayer-customize-inside-control-row">
594
+ <label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $this->label ); ?></label>
595
+ <input
596
+ id="<?php echo esc_attr( $input_id ); ?>"
597
+ class="pagelayer-customize-checkbox"
598
+ <?php echo $describedby_attr; ?>
599
+ type="checkbox"
600
+ value="<?php echo esc_attr( $this->value() ); ?>"
601
+ <?php $this->link(); ?>
602
+ <?php checked( $this->value() ); ?>
603
+ />
604
+ <?php if ( ! empty( $this->description ) ) : ?>
605
+ <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
606
+ <?php endif; ?>
607
+ </span>
608
+ <?php
609
+ break;
610
+ case 'radio':
611
+ if ( empty( $this->choices ) ) {
612
+ return;
613
+ }
614
+
615
+ $name = '_customize-radio-' . $this->id;
616
+ ?>
617
+ <?php if ( ! empty( $this->label ) ) : ?>
618
+ <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
619
+ <?php endif; ?>
620
+ <?php if ( ! empty( $this->description ) ) : ?>
621
+ <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
622
+ <?php endif; ?>
623
+ <span class="pagelayer-customize-inside-control-row">
624
+ <?php foreach ( $this->choices as $value => $label ) : ?>
625
+
626
+ <input
627
+ id="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"
628
+ class="pagelayer-customize-radio"
629
+ type="radio"
630
+ <?php echo $describedby_attr; ?>
631
+ value="<?php echo esc_attr( $value ); ?>"
632
+ name="<?php echo esc_attr( $name ); ?>"
633
+ <?php $this->link(); ?>
634
+ <?php checked( $this->value(), $value ); ?>
635
+ data-label="<?php echo esc_html( $label ); ?>"
636
+ />
637
+ <?php endforeach; ?>
638
+ </span>
639
+ <?php
640
+ break;
641
+ case 'divider':
642
+ echo '<hr class="pagelayer-customize-divider">';
643
+ break;
644
+ case 'slider':
645
+ ?>
646
+ <div class="pagelayer-slider-custom-control">
647
+ <span class="customize-control-title"><?php echo esc_html( $this->label ); ?>
648
+ <?php if(!empty($this->responsive )){?>
649
+ <span class="pagelayer-devices">
650
+ <button type="button" class="active-device" aria-pressed="true" data-device="desktop">
651
+ <i class="dashicons dashicons-desktop"></i>
652
+ </button>
653
+ <button type="button"aria-pressed="false" data-device="tablet">
654
+ <i class="dashicons dashicons-tablet"></i>
655
+ </button>
656
+ <button type="button" aria-pressed="false" data-device="mobile">
657
+ <i class="dashicons dashicons-smartphone"></i>
658
+ </button>
659
+ </span>
660
+ <?php } ?>
661
+ </span>
662
+ <?php
663
+ if(!empty($units)){
664
+ ?>
665
+ <span class="pagelayer-units">
666
+ <input type="hidden" class="pagelayer-unit-input" value="<?php echo esc_attr($this->value('unit')); ?>" <?php $this->link('unit'); ?>></input>
667
+ <?php
668
+ foreach($units as $unit){
669
+ echo '<span data-unit="'.$unit.'"> '.$unit.' </span>';
670
+ }
671
+ ?>
672
+ </span>
673
+ <?php }
674
+
675
+ $screens = array('');
676
+ $set_link = 'slider';
677
+
678
+ if(!empty($this->responsive)){
679
+ $screens = array('desktop' => '_desktop', 'tablet' => '_tablet', 'mobile' => '_mobile');
680
+ }
681
+
682
+ foreach($screens as $screen => $_screen){
683
+
684
+ $show_device = empty($_screen)? '' : 'data-show-device="'.$_screen.'"';
685
+
686
+ echo '<div class="pagelayer-control-typography" '.$show_device.'>';
687
+ ?>
688
+ <input class="pagelayer-slider" type="range" min="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" max="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" step="<?php echo esc_attr( $this->input_attrs['step'] ); ?>" value="<?php echo esc_attr( $this->value($set_link.$_screen) ); ?>" />
689
+ <input type="number" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value($set_link.$_screen) ); ?>" class="customize-control-slider-value" <?php $this->link($set_link.$_screen); ?> min="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" max="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" step="<?php echo esc_attr( $this->input_attrs['step'] ); ?>"/>
690
+
691
+ </div>
692
+ <?php } ?>
693
+ </div>
694
+ <?php
695
+ break;
696
+ }
697
+ }
698
+ }
699
+
700
  /**
701
  * Switch sanitization
702
  *
703
+ * @param string Switch value
704
  * @return integer Sanitized value
705
  */
706
  if ( ! function_exists( 'pagelayer_switch_sanitization' ) ) {
main/customizer.php CHANGED
@@ -354,7 +354,7 @@ function pagelayer_register_typo_customizer_control($wp_customize, $args){
354
  *
355
  * @return void
356
  */
357
- function pagelayer_register_padding_customizer_control($wp_customize, $args){
358
 
359
  $settings_for_control = array();
360
  $screens = array('');
@@ -367,7 +367,7 @@ function pagelayer_register_padding_customizer_control($wp_customize, $args){
367
  }
368
 
369
  if(!empty($args['responsive'])){
370
- $screens = array('', '_tablet', '_mobile');
371
  }
372
 
373
  if(!empty($args['control_array_sufix'])){
@@ -375,15 +375,23 @@ function pagelayer_register_padding_customizer_control($wp_customize, $args){
375
  }
376
 
377
  // Register settings
378
- foreach($screens as $screen){
379
  foreach($settings as $setting){
380
 
381
  // Skip units for responsive
382
- if($setting == 'unit' && !empty($screen)){
383
  continue;
384
  }
385
-
386
- $setting_name = $args['control'].$screen.$control_array_sufix.'['.$setting.']';
 
 
 
 
 
 
 
 
387
  $settings_for_control[$setting.$screen] = $setting_name;
388
 
389
  $setting_args = array(
@@ -399,12 +407,100 @@ function pagelayer_register_padding_customizer_control($wp_customize, $args){
399
  $setting_args['type'] = $args['setting_type'];
400
  }
401
 
 
 
 
 
402
  $wp_customize->add_setting( $setting_name, $setting_args);
403
  }
404
  }
405
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  $args['settings'] = $settings_for_control;
407
  $wp_customize->add_control( new Pagelayer_Padding_Control(
408
  $wp_customize, $args['control']. @$args['control_array_sufix'], $args
409
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  }
354
  *
355
  * @return void
356
  */
357
+ function pagelayer_register_padding_customizer_control($wp_customize, $args, $screen_array = false){
358
 
359
  $settings_for_control = array();
360
  $screens = array('');
367
  }
368
 
369
  if(!empty($args['responsive'])){
370
+ $screens = array('desktop' => '', 'tablet' => '_tablet', 'mobile' => '_mobile');
371
  }
372
 
373
  if(!empty($args['control_array_sufix'])){
375
  }
376
 
377
  // Register settings
378
+ foreach($screens as $_screen => $screen){
379
  foreach($settings as $setting){
380
 
381
  // Skip units for responsive
382
+ if($setting == 'unit' && (!empty($screen) || $screen_array)){
383
  continue;
384
  }
385
+
386
+ $setting_name = $args['control'];
387
+
388
+ if($screen_array && count($screens) > 1){
389
+ $setting_name .= $control_array_sufix.'['.$_screen.']';
390
+ }else{
391
+ $setting_name .= $screen.$control_array_sufix;
392
+ }
393
+
394
+ $setting_name .= '['.$setting.']';
395
  $settings_for_control[$setting.$screen] = $setting_name;
396
 
397
  $setting_args = array(
407
  $setting_args['type'] = $args['setting_type'];
408
  }
409
 
410
+ if(!empty($args['sanitize_callback'])){
411
+ $setting_args['sanitize_callback'] = $args['sanitize_callback'];
412
+ }
413
+
414
  $wp_customize->add_setting( $setting_name, $setting_args);
415
  }
416
  }
417
 
418
+ // If we save responsive values in same variables
419
+ if($screen_array && !empty($args['units'])){
420
+ $setting_name = $args['control'].$control_array_sufix.'[unit]';
421
+ $settings_for_control['unit'] = $setting_name;
422
+ $setting_args = array(
423
+ 'capability' => $args['capability'],
424
+ 'transport' => $args['transport'],
425
+ );
426
+
427
+ if(!empty($args['setting_type'])){
428
+ $setting_args['type'] = $args['setting_type'];
429
+ }
430
+
431
+ $wp_customize->add_setting( $setting_name, $setting_args);
432
+ }
433
+
434
  $args['settings'] = $settings_for_control;
435
  $wp_customize->add_control( new Pagelayer_Padding_Control(
436
  $wp_customize, $args['control']. @$args['control_array_sufix'], $args
437
  ));
438
+ }
439
+
440
+ /**
441
+ * Register the slider control.
442
+ *
443
+ * @return void
444
+ */
445
+ function pagelayer_register_slider_custoze_control($wp_customize, $args){
446
+
447
+ $settings_for_control = array();
448
+ $setting = 'slider';
449
+ $screens = array('');
450
+
451
+ if(!empty($args['responsive'])){
452
+ $screens = array('desktop' => '_desktop', 'tablet' => '_tablet', 'mobile' => '_mobile');
453
+ }
454
+
455
+ // Register settings
456
+ foreach($screens as $screen => $_screen){
457
+
458
+ $setting_name = $args['control'];
459
+
460
+ if(count($screens) > 1){
461
+ $setting_name .= '['.$screen.']';
462
+ }
463
+
464
+ $settings_for_control[$setting.$_screen] = $setting_name;
465
+
466
+ $setting_args = array(
467
+ 'capability' => $args['capability'],
468
+ 'transport' => $args['transport'],
469
+ );
470
+
471
+ if(!empty($args['default'])){
472
+ $setting_args['default'] = $args['default'];
473
+ }
474
+
475
+ if(!empty($args['setting_type'])){
476
+ $setting_args['type'] = $args['setting_type'];
477
+ }
478
+
479
+ if(!empty($args['sanitize_callback'])){
480
+ $setting_args['sanitize_callback'] = $args['sanitize_callback'];
481
+ }
482
+
483
+ $wp_customize->add_setting($setting_name, $setting_args);
484
+ }
485
+
486
+ // Register setting for units
487
+ if(!empty($args['units'])){
488
+ $setting_name = $args['control'].'[unit]';
489
+ $settings_for_control['unit'] = $setting_name;
490
+ $setting_args = array(
491
+ 'capability' => $args['capability'],
492
+ 'transport' => $args['transport'],
493
+ );
494
+
495
+ if(!empty($args['setting_type'])){
496
+ $setting_args['type'] = $args['setting_type'];
497
+ }
498
+
499
+ $wp_customize->add_setting( $setting_name, $setting_args);
500
+ }
501
+
502
+ $args['settings'] = $settings_for_control;
503
+ $args['type'] = 'slider';
504
+
505
+ $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, $args['control'], $args ));
506
  }
main/functions.php CHANGED
@@ -3488,22 +3488,33 @@ function pagelayer_load_global_palette(){
3488
  }
3489
  }
3490
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3491
  // Sanitize style props for colors and fons
3492
  function pagelayer_sanitize_global_style($val, $val_desk = '', $mode = 'desktop'){
3493
  global $pagelayer;
3494
 
3495
  // Sanitize Global background color
3496
  if( !empty($val['background-color']) && $val['background-color'][0] == '$'){
3497
- $gkey = substr($val['background-color'], 1);
3498
- $gcolor = isset($pagelayer->global_colors[$gkey]) ? $gkey : 'primary';
3499
- $val['background-color'] = 'var(--pagelayer-color-'.$gcolor.')';
3500
  }
3501
 
3502
  // Sanitize Global color
3503
  if( !empty($val['color']) && $val['color'][0] == '$'){
3504
- $gkey = substr($val['color'], 1);
3505
- $gcolor = isset($pagelayer->global_colors[$gkey]) ? $gkey : 'primary';
3506
- $val['color'] = 'var(--pagelayer-color-'.$gcolor.')';
3507
  }
3508
 
3509
  // Not set global for typo
3488
  }
3489
  }
3490
 
3491
+ // Get global colors
3492
+ function pagelayer_sanitize_global_color($val){
3493
+ global $pagelayer;
3494
+
3495
+ if($val[0] != '$'){
3496
+ return $val;
3497
+ }
3498
+
3499
+ $gkey = substr($val, 1);
3500
+ $gcolor = isset($pagelayer->global_colors[$gkey]) ? $gkey : 'primary';
3501
+ $val = 'var(--pagelayer-color-'.$gcolor.')';
3502
+
3503
+ return $val;
3504
+ }
3505
+
3506
  // Sanitize style props for colors and fons
3507
  function pagelayer_sanitize_global_style($val, $val_desk = '', $mode = 'desktop'){
3508
  global $pagelayer;
3509
 
3510
  // Sanitize Global background color
3511
  if( !empty($val['background-color']) && $val['background-color'][0] == '$'){
3512
+ $val['background-color'] = pagelayer_sanitize_global_color($val['background-color']);
 
 
3513
  }
3514
 
3515
  // Sanitize Global color
3516
  if( !empty($val['color']) && $val['color'][0] == '$'){
3517
+ $val['color'] = pagelayer_sanitize_global_color($val['color']);
 
 
3518
  }
3519
 
3520
  // Not set global for typo
main/woocommerce.php CHANGED
@@ -22,101 +22,97 @@ if(!defined('PAGELAYER_VERSION')) {
22
  exit('Hacking Attempt !');
23
  }
24
 
25
- add_filter('wp_nav_menu_items', 'popularfx_add_woo_cart', 10, 2);
26
- add_filter('wp_page_menu', 'popularfx_add_woo_cart', 10, 2);
27
- function popularfx_add_woo_cart($items, $args) {
28
-
29
- if( get_theme_mod( 'enable_menu_cart' ) ) {
30
- $items .= '<li class="page-item pfx-menu-cart cart-customlocation menu-item menu-item-type-post_type menu-item-object-page"><a href=""><span class="dashicons dashicons-cart"></span><sup></sup></a></li>';
31
- }
32
 
33
- return $items;
34
 
35
- }
36
-
37
- // WooCommerce Checkout Fields Hook
38
- add_filter('woocommerce_checkout_fields','popularfx_wc_checkout_fields_no_label',10);
39
-
40
- // Our hooked in function - $fields is passed via the filter!
41
- // Action: remove label from $fields
42
- function popularfx_wc_checkout_fields_no_label($fields) {
43
 
44
- if( get_theme_mod( 'enable_label_placeholder' ) ) {
45
-
46
- // loop by category
47
- foreach ($fields as $category => $value) {
48
- // loop by fields
49
- foreach ($fields[$category] as $field => $property) {
50
-
51
- //Add label as placeholder
52
- if( $fields[$category][$field]['required'] == true ){
53
- //Add required * in placeholder
54
- $fields[$category][$field]['placeholder'] = $fields[$category][$field]['label'] .' *';
55
- }else{
56
- //Add (optional) in placeholder
57
- $fields[$category][$field]['placeholder'] = $fields[$category][$field]['label'] .'(optional)';
58
- }
59
-
60
- // remove label property
61
- unset($fields[$category][$field]['label']);
62
- }
63
  }
 
 
 
 
 
 
64
 
 
 
 
65
  }
66
 
67
- return $fields;
 
 
 
68
  }
69
 
70
- // CHange number of related product on single page
71
- add_filter( 'woocommerce_output_related_products_args', 'popularfx_single_product_number_related_products', 9999 );
72
- function popularfx_single_product_number_related_products( $args ) {
 
 
73
 
74
- $args['posts_per_page'] = get_theme_mod( 'number_related_product' ); // # of related products
75
- $args['columns'] = get_theme_mod( 'number_related_product' ); // # of columns per row
 
76
 
77
- return $args;
78
-
79
  }
80
 
81
- add_action( 'customize_controls_print_scripts', 'popularfx_wc_add_scripts' );
82
- function popularfx_wc_add_scripts(){
83
  ?>
84
  <script>
85
 
86
  // Script to load Shop page when user click woocommerce customizer
87
  jQuery( function( $ ) {
88
- wp.customize.panel( 'woocommerce', function( panel ) {
89
  panel.expanded.bind( function( isExpanded ) {
90
  if ( isExpanded ) {
91
- wp.customize.previewer.previewUrl.set( '<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>' );
92
  }
93
  } );
94
  } );
95
- wp.customize.section( 'pfx_woo_cart_page', function( section ) {
 
 
 
 
 
 
 
96
  section.expanded.bind( function( isExpanded ) {
97
  if ( isExpanded ) {
98
- wp.customize.previewer.previewUrl.set( '<?php echo esc_js( wc_get_page_permalink( 'cart' ) ); ?>' );
99
  }
100
  } );
101
  } );
102
- wp.customize.section( 'pfx_woo_myaccount_page', function( section ) {
103
  section.expanded.bind( function( isExpanded ) {
104
  if ( isExpanded ) {
105
- wp.customize.previewer.previewUrl.set( '<?php echo esc_js( wc_get_page_permalink( 'myaccount' ) ); ?>' );
106
  }
107
  } );
108
  } );
109
- wp.customize.section( 'pfx_woo_shop_pagination', function( section ) {
110
  section.expanded.bind( function( isExpanded ) {
111
  if ( isExpanded ) {
112
- wp.customize.previewer.previewUrl.set( '<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>' );
113
  }
114
  } );
115
  } );
116
- wp.customize.section( 'pfx_woo_general', function( section ) {
117
  section.expanded.bind( function( isExpanded ) {
118
  if ( isExpanded ) {
119
- wp.customize.previewer.previewUrl.set( '<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>' );
120
  }
121
  } );
122
  } );
@@ -124,1072 +120,523 @@ jQuery( function( $ ) {
124
  </script>
125
  <?php
126
  }
127
-
128
- add_action( 'wp_head', 'popularfx_woocommerce_styles', 1000 );
129
- function popularfx_woocommerce_styles(){
130
-
131
- $styles = '<style id="popularfx-woocommerce-styles" type="text/css">'.PHP_EOL;
132
 
133
- // Show / Hide on sale
134
- $disable_onsale = get_theme_mod('disable_onsale');
135
- if(!empty($disable_onsale)){
136
- $styles .= '.woocommerce .product span.onsale { display : none; } ';
137
- }else{
138
- $styles .= '.woocommerce .product span.onsale { display : block; background-color: '. get_theme_mod('pfx_woo_onsale_bg_color', '#FF2626') .'; color: '. get_theme_mod('pfx_woo_onsale_color', '#FFFFFF') .'; border-radius: '. get_theme_mod('onsale_radius', 100) .'%;} ';
139
- }
140
 
141
- // Show / Hide star rating
142
- $disable_starrating = get_theme_mod('disable_starrating');
143
- $styles .= '.woocommerce ul.products li.product .star-rating.pfx-star-rating { display : '. (empty($disable_starrating) ? 'block' : 'none') .'; }'.PHP_EOL;
144
-
145
- // Show / Hide Related product
146
- $disable_related_product = get_theme_mod('disable_related_product');
147
- $styles .= '.product section.related.products{ display : '. (empty($disable_related_product) ? 'block' : 'none') .'; }'.PHP_EOL;
148
-
149
- // Show / Hide Upsells
150
- $disable_upsells = get_theme_mod('disable_upsells');
151
- $styles .= '.product section.up-sells.upsells.products { display : '. (empty($disable_upsells) ? 'block' : 'none') .';}'.PHP_EOL;
152
-
153
- // Show / Hide Cross sells
154
- $disable_cross_sells = get_theme_mod('disable_cross_sells');
155
- $styles .= '.woocommerce .cart-collaterals .cross-sells, .woocommerce-page .cart-collaterals .cross-sells{ display : '. (empty($disable_cross_sells) ? 'block' : 'none') .';}'.PHP_EOL;
156
-
157
- // Show / Hide Order Note
158
- $disable_order_note = get_theme_mod('disable_order_note');
159
- $styles .= '.woocommerce-additional-fields{ display : '. (empty($disable_order_note) ? 'block' : 'none') .';}'.PHP_EOL;
160
-
161
- // Show / Hide Coupon Field
162
- $disable_coupon_field = get_theme_mod('disable_coupon_field');
163
- $styles .= '.woocommerce-form-coupon-toggle{ display : '. (empty($disable_coupon_field) ? 'block' : 'none') .';}'.PHP_EOL;
164
 
165
- // Show / Hide Product breadcrumb
166
- $disable_product_breadcrumb = get_theme_mod('disable_product_breadcrumb');
167
- $styles .= '.single-product nav.woocommerce-breadcrumb{ display : '. (empty($disable_product_breadcrumb) ? 'block' : 'none') .';}'.PHP_EOL;
 
168
 
169
- // Show / Hide Product description
170
- $disable_product_description = get_theme_mod('disable_product_description');
171
- $styles .= '.single-product .woocommerce-tabs.wc-tabs-wrapper{ display : '. (empty($disable_product_description) ? 'block' : 'none') .';}'.PHP_EOL;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
- $styles .= '.woocommerce div.product .woocommerce-tabs .panel .woocommerce-Reviews #comments .commentlist .star-rating, .woocommerce div.product .woocommerce-product-rating, .woocommerce ul.products li.product .star-rating, .woocommerce ul.products li.product .star-rating.pfx-star-rating, .woocommerce ul.product_list_widget li .star-rating { color: '. get_theme_mod('pfx_woo_starrating_color', '#5c7aea') . '; }'.PHP_EOL;
174
- $styles .= '.woocommerce ul.products li.product .star-rating:hover, .woocommerce ul.products li.product .star-rating.pfx-star-rating:hover { color: '. get_theme_mod('pfx_woo_starrating_hover_color', '#000000') . '; }'.PHP_EOL;
175
-
176
- $styles .= 'li.cart-customlocation span.dashicons.dashicons-cart { color: '. get_theme_mod('menu_cart_color', 'inherit') . '; }'.PHP_EOL;
177
- $styles .= 'li.cart-customlocation span.dashicons.dashicons-cart + sup{ color: '. get_theme_mod('menu_cart_number_color', 'inherit') . '; }'.PHP_EOL;
178
 
179
- $styles .= '.woocommerce #content div.product div.images, .woocommerce div.product div.images, .woocommerce-page #content div.product div.images, .woocommerce-page div.product div.images { width: '. get_theme_mod('product_image_width', 48) . '% !important; }
180
- .woocommerce #content div.product div.summary, .woocommerce div.product div.summary, .woocommerce-page #content div.product div.summary, .woocommerce-page div.product div.summary { width: calc(96% - '. get_theme_mod('product_image_width', 48) . '%) !important; }'.PHP_EOL;
181
-
182
- $def_pad = get_theme_mod('pfx_woo_default_padding', 15);
183
- $styles .= ( !empty(get_theme_mod('pfx_woo_shop_padding')) ) ? 'body.post-type-archive-product .site-main { padding: '. get_theme_mod('pfx_woo_shop_padding', 15) . 'px ; }' : 'body.post-type-archive-product .site-main { padding: '. $def_pad . 'px ; } ';
184
-
185
- $styles .= ( !empty(get_theme_mod('pfx_woo_product_padding')) ) ? 'body.product-template-default.single-product main.site-main { padding: '. get_theme_mod('pfx_woo_product_padding', 15) . 'px ; }' : 'body.product-template-default.single-product main.site-main { padding: '. $def_pad . 'px ; } ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
- $styles .= ( !empty(get_theme_mod('pfx_woo_cart_padding')) ) ? 'body.woocommerce-cart main.site-main { padding: '. get_theme_mod('pfx_woo_cart_padding', 15) . 'px ; }' : 'body.woocommerce-cart main.site-main { padding: '.$def_pad . 'px ; } ';
 
 
 
 
 
 
 
188
 
189
- $styles .= ( !empty(get_theme_mod('pfx_woo_checkout_padding')) ) ? 'body.woocommerce-checkout main.site-main { padding: '. get_theme_mod('pfx_woo_checkout_padding', 15) . 'px ; }' : 'body.woocommerce-checkout main.site-main { padding: '.$def_pad . 'px ; } ';
 
190
 
191
- $styles .= ( !empty(get_theme_mod('pfx_woo_myaccount_padding')) ) ? 'body.woocommerce-account main.site-main { padding: '. get_theme_mod('pfx_woo_myaccount_padding', 15) . 'px ; }' : 'body.woocommerce-account main.site-main { padding: '.$def_pad . 'px ; } ';
192
-
193
- $styles .= 'p.woocommerce-store-notice.demo_store { background-color: '. get_theme_mod('pfx_woo_storenotice_bg_color', '#5c7aea') . '; } p.woocommerce-store-notice.demo_store, p.woocommerce-store-notice.demo_store a{color: '. get_theme_mod('pfx_woo_storenotice_color', '#FFFFFF') . '; }'.PHP_EOL;
194
- $styles .= '.woocommerce main nav.woocommerce-pagination ul li a { background-color: '. get_theme_mod('shoppagination_bg_color', '#FFFFFF') . '; color: '. get_theme_mod('shoppagination_color', '#000000') . '; border: '. get_theme_mod('shoppagination_borderwidth', 1) . 'px solid ; border-color: '. get_theme_mod('shoppagination_border_color', 'transparent') . '; border-radius: '. get_theme_mod('shoppagination_borderradius', 0) . 'px;}'.PHP_EOL;
195
- $styles .= '.woocommerce main nav.woocommerce-pagination ul li a:focus, .woocommerce main nav.woocommerce-pagination ul li a:hover, .woocommerce main nav.woocommerce-pagination ul li span.current { background-color: '. get_theme_mod('shoppagination_bg_hover_color', '#000000') . '; color: '. get_theme_mod('shoppagination_hover_color', '#ffffff') . '; border: '. get_theme_mod('shoppagination_borderwidth', 1) . 'px solid ; border-color: '. get_theme_mod('shoppagination_hover_border_color', 'transparent') . '; border-radius: '. get_theme_mod('shoppagination_borderradius', 0) . 'px; }'.PHP_EOL;
 
 
 
196
 
197
- //Woocommerce Button Styling from Customizer
198
- $styles .= '.woocommerce .product #respond input#submit, .woocommerce .product a.button, .woocommerce button.button, .woocommerce input.button, .woocommerce .product button.button, .woocommerce .product input.button, .woocommerce .product #respond input#submit.alt, .woocommerce .product a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt .woocommerce .product button.button.alt, .woocommerce .product input.button.alt, .woocommerce a.button.alt { padding: '. get_theme_mod('pfx_woo_btn_padding') . 'px; background-color: '. get_theme_mod('pfx_woo_btn_bg_color', '#5c7aea') . '; color: '. get_theme_mod('pfx_woo_btn_color', '#FFFFFF') . '; border-width: '. get_theme_mod('pfx_woo_btn_border', 0).'px; border-color: '. get_theme_mod('pfx_woo_btn_border_color', '#FFFFFF').'; border-radius: '. get_theme_mod('pfx_woo_btn_border_radius', 5 ).'px;}'.PHP_EOL;
199
- $styles .= '.woocommerce .product #respond input#submit:hover, .woocommerce .product a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover, .woocommerce .product button.button:hover, .woocommerce .product input.button:hover, .woocommerce .product #respond input#submit.alt:hover, .woocommerce .product a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover .woocommerce .product button.button.alt:hover, .woocommerce .product input.button.alt:hover, .woocommerce a.button.alt:hover { background-color: '. get_theme_mod('pfx_woo_btn_hover_bg_color', '#000000') . ' !important; color: '. get_theme_mod('pfx_woo_btn_hover_color', '#FFFFFF') . ' !important; border: '. get_theme_mod('pfx_woo_btn_hover_border', 0 ).'px; border-color: '. get_theme_mod('pfx_woo_btn_hover_border_color', '#FFFFFF').' !important; border-radius: '. get_theme_mod('pfx_woo_btn_hover_border_radius', 5).'px !important; }'.PHP_EOL;
200
 
201
- $styles .= '.single-product .woocommerce-breadcrumb, .single-product .woocommerce-breadcrumb * { color: '. get_theme_mod('product_breadcrumb_color', '#767676') . '; } ';
202
- $styles .= '.single-product div.product .woocommerce-product-details__short-description, .single-product div.product .woocommerce-product-details__short-description p, .single-product div.product .product_meta, .single-product div.product .entry-content { color: '. get_theme_mod('product_description_color', '#444444') . '; }'.PHP_EOL;
203
- $styles .= '.woocommerce ul.products li.product .price, .woocommerce div.product p.price, .woocommerce div.product span.price { color: '. get_theme_mod('product_price_color', '#111111') . '; }'.PHP_EOL;
204
- $styles .= '.single-product div.product .entry-title { color: '. get_theme_mod('product_title_color', '#000000') . '; }'.PHP_EOL;
205
 
206
- $styles .= PHP_EOL.'</style>';
207
 
208
  echo $styles;
209
  }
210
 
211
- // PopularFX + WooCommerce customizer
212
- add_action( 'customize_register', 'popularfx_woocommerce_customizer', 100 );
213
- function popularfx_woocommerce_customizer($wp_customize){
214
-
215
- //PopularFX + WooCommerce Panel
216
- $wp_customize->add_panel( 'woocommerce', array(
217
- 'priority' => 10,
218
- 'title' => __( 'PopularFX + WooCommerce', 'popularfx' ),
219
- ) );
220
-
221
- //Woocommerce Sections
222
- $wp_customize->add_section( 'woocommerce_store_notice', array(
223
- 'title' => __( 'Store Notice', 'popularfx' ),
224
- 'priority' => 1,
225
- 'panel' => 'woocommerce',
226
- ) );
227
-
228
- $wp_customize->add_section( 'pfx_woo_general', array(
229
- 'capability' => 'edit_theme_options',
230
- 'priority' => 2,
231
- 'title' => __( 'General','popularfx'),
232
- 'panel' => 'woocommerce',
233
- 'description' => __( 'These options let you change the appearance of the basics WooCommerce design.', 'woocommerce' ),
234
- ) );
235
-
236
- $wp_customize->add_section( 'pfx_woo_btn', array(
237
- 'capability' => 'edit_theme_options',
238
- 'priority' => 3,
239
- 'title' => __( 'WooCommerce Buttons','popularfx'),
240
- 'panel' => 'woocommerce',
241
- ) );
242
-
243
- $wp_customize->add_section( 'woocommerce_product_catalog', array(
244
- 'title' => __( 'Shop Page/Product Catalog', 'popularfx' ),
245
- 'priority' => 4,
246
- 'panel' => 'woocommerce',
247
- ) );
248
-
249
- $wp_customize->add_section( 'pfx_woo_single_product', array(
250
- 'title' => __( 'Single Product', 'popularfx' ),
251
- 'priority' => 5,
252
- 'panel' => 'woocommerce',
253
- 'description' => __( 'These options let you change the appearance of the WooCommerce single product page.', 'woocommerce' ),
254
- ) );
255
-
256
- $wp_customize->add_section( 'pfx_woo_cart_page', array(
257
- 'title' => __( 'Cart Page Design', 'popularfx' ),
258
- 'priority' => 6,
259
- 'panel' => 'woocommerce',
260
- 'description' => __( 'These options let you change the appearance of the WooCommerce cart page.', 'woocommerce' ),
261
- ) );
262
-
263
- $wp_customize->add_section( 'woocommerce_checkout', array(
264
- 'title' => __( 'Checkout Page Design', 'woocommerce' ),
265
- 'priority' => 7,
266
- 'panel' => 'woocommerce',
267
- ) );
268
 
269
- $wp_customize->add_section( 'pfx_woo_myaccount_page', array(
270
- 'title' => __( 'Myaccount Page Design', 'popularfx' ),
271
- 'priority' => 8,
272
- 'panel' => 'woocommerce',
273
- 'description' => __( 'These options let you change the appearance of the WooCommerce myaccount page.', 'woocommerce' ),
274
- ) );
275
-
276
- $wp_customize->add_section( 'pfx_woo_shop_pagination', array(
277
- 'capability' => 'edit_theme_options',
278
- 'priority' => 9,
279
- 'title' => __( 'Shop Page Pagination Design','popularfx'),
280
- 'panel' => 'woocommerce',
281
- ) );
282
-
283
- // WooCommerce default page padding
284
- $wp_customize->add_setting('pfx_woo_default_padding', array(
285
- 'capability' => 'edit_theme_options',
286
- 'transport' => 'refresh',
287
- 'default' => 15,
288
- 'sanitize_callback' => 'absint',
289
- ) );
290
 
291
- $wp_customize->add_control( 'pfx_woo_default_padding', array(
292
- 'type' => 'number',
293
- 'priority' => 1,
294
- 'section' => 'pfx_woo_general',
295
- 'description' => 'Set container default padding in "px"',
296
- 'settings' => 'pfx_woo_default_padding',
297
- 'label' => __('Default Container Padding', 'popularfx' ),
298
- 'input_attrs' => array(
299
- 'min' => 0,
300
- 'max' => 200,
301
- 'step' => 1,
 
 
 
 
302
  ),
303
- ) );
304
-
305
- // Sale Notification(General Setting)
306
- $wp_customize->add_setting( 'disable_onsale', array(
307
- 'capability' => 'edit_theme_options',
308
- 'transport' => 'postMessage',
309
- 'default' => 0,
310
- 'sanitize_callback' => 'popularfx_switch_sanitization',
311
- ) );
312
-
313
- $wp_customize->add_control( 'disable_onsale', array(
314
- 'type' => 'checkbox',
315
- 'section' => 'pfx_woo_general',
316
- 'priority' => 1,
317
- 'settings' => 'disable_onsale',
318
- 'label' => __('Disable Sale Notification', 'popularfx' )
319
- ) );
320
 
321
- $wp_customize->add_setting( 'onsale_radius', array(
322
- 'capability' => 'edit_theme_options',
323
- 'transport' => 'postMessage',
324
- 'default' => 100,
325
- 'sanitize_callback' => 'absint',
326
- ) );
327
-
328
- $wp_customize->add_control( 'onsale_radius', array(
329
- 'type' => 'number',
330
- 'section' => 'pfx_woo_general',
331
- 'settings' => 'onsale_radius',
332
- 'label' => __( 'Sale Notification Radius', 'popularfx' ),
333
- 'description' => __( 'Set the border radius for Sale Notification','popularfx'),
334
- 'input_attrs' => array(
335
- 'min' => 0,
336
- 'max' => 100,
337
- 'step' => 1,
338
  ),
339
- ) );
340
-
341
- $wp_customize->add_setting('pfx_woo_onsale_bg_color', array(
342
- 'capability' => 'edit_theme_options',
343
- 'transport' => 'postMessage',
344
- 'default' => '#FF2626',
345
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
346
- ) );
347
-
348
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
349
- $wp_customize, 'pfx_woo_onsale_bg_color', array(
350
- 'section' => 'pfx_woo_general',
351
- 'description' => 'Set Background color for Sale Notification',
352
- 'settings' => 'pfx_woo_onsale_bg_color',
353
- 'label' => __('Sale Background', 'popularfx' ),
354
- 'show_opacity' => true
355
- )
356
- ) );
357
-
358
- $wp_customize->add_setting('pfx_woo_onsale_color', array(
359
- 'capability' => 'edit_theme_options',
360
- 'transport' => 'postMessage',
361
- 'default' => '#FFFFFF',
362
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
363
- ) );
364
-
365
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
366
- $wp_customize, 'pfx_woo_onsale_color', array(
367
- 'section' => 'pfx_woo_general',
368
- 'description' => 'Set text color for Sale Notification',
369
- 'settings' => 'pfx_woo_onsale_color',
370
- 'label' => __('Sale Text Color', 'popularfx' ),
371
- 'show_opacity' => true
372
- )
373
- ) );
374
-
375
- //Shop Star Rating(General Setting)
376
- $wp_customize->add_setting( 'disable_starrating', array(
377
- 'capability' => 'edit_theme_options',
378
- 'transport' => 'postMessage',
379
- 'default' => 0,
380
- 'sanitize_callback' => 'popularfx_switch_sanitization',
381
- ) );
382
-
383
- $wp_customize->add_control( 'disable_starrating', array(
384
- 'type' => 'checkbox',
385
- 'section' => 'pfx_woo_general',
386
- 'settings' => 'disable_starrating',
387
- 'label' => __('Disable Star-Rating on Shop Page', 'popularfx' )
388
- ) );
389
-
390
- $wp_customize->add_setting('pfx_woo_starrating_color', array(
391
- 'capability' => 'edit_theme_options',
392
- 'transport' => 'postMessage',
393
- 'default' => '#5c7aea',
394
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
395
- ) );
396
-
397
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
398
- $wp_customize, 'pfx_woo_starrating_color', array(
399
- 'section' => 'pfx_woo_general',
400
- 'description' => 'Set color for star rating',
401
- 'settings' => 'pfx_woo_starrating_color',
402
- 'label' => __('Star Rating Color', 'popularfx' ),
403
- 'show_opacity' => true
404
- )
405
- ) );
406
-
407
- $wp_customize->add_setting('pfx_woo_starrating_hover_color', array(
408
- 'capability' => 'edit_theme_options',
409
- 'transport' => 'refresh',
410
- 'default' => '#000000',
411
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
412
- ) );
413
-
414
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
415
- $wp_customize, 'pfx_woo_starrating_hover_color', array(
416
- 'section' => 'pfx_woo_general',
417
- 'description' => 'Set hover color for star rating',
418
- 'settings' => 'pfx_woo_starrating_hover_color',
419
- 'label' => __('Star Rating Hover Color', 'popularfx' ),
420
- 'show_opacity' => true
421
- )
422
- ) );
423
-
424
- //Header Menu Cart(General Setting)
425
- $wp_customize->add_setting( 'enable_menu_cart', array(
426
- 'capability' => 'edit_theme_options',
427
- 'transport' => 'refresh',
428
- 'default' => 0,
429
- 'sanitize_callback' => 'popularfx_switch_sanitization',
430
- ) );
431
-
432
- $wp_customize->add_control( 'enable_menu_cart', array(
433
- 'type' => 'checkbox',
434
- 'section' => 'pfx_woo_general',
435
- 'settings' => 'enable_menu_cart',
436
- 'label' => __('Show Cart Icon in Header Menu', 'popularfx' )
437
- ) );
438
 
439
- $wp_customize->add_setting('menu_cart_color', array(
440
- 'capability' => 'edit_theme_options',
441
- 'transport' => 'postMessage',
442
- 'default' => '',
443
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
444
- ) );
445
 
446
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
447
- $wp_customize, 'menu_cart_color', array(
448
- 'section' => 'pfx_woo_general',
449
- 'description' => 'Set menu cart icon color by default menu color is applied',
450
- 'settings' => 'menu_cart_color',
451
- 'label' => __('Header Menu Cart Color', 'popularfx' ),
452
- 'show_opacity' => true
453
- )
454
- ) );
455
 
456
- $wp_customize->add_setting('menu_cart_number_color', array(
457
- 'capability' => 'edit_theme_options',
458
- 'transport' => 'postMessage',
459
- 'default' => '',
460
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
461
- ) );
 
 
 
 
 
 
 
 
462
 
463
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
464
- $wp_customize, 'menu_cart_number_color', array(
465
- 'section' => 'pfx_woo_general',
466
- 'description' => 'Set menu cart number color by default menu color is applied',
467
- 'settings' => 'menu_cart_number_color',
468
- 'label' => __('Header Menu Cart Numbers Color', 'popularfx' ),
469
- 'show_opacity' => true
470
- )
471
- ) );
472
-
473
- //WooCommerece Button
474
- $wp_customize->add_setting( 'pfx_woo_btn_padding', array(
475
- 'capability' => 'edit_theme_options',
476
- 'transport' => 'postMessage',
477
- 'sanitize_callback' => 'absint',
478
- ) );
479
-
480
- $wp_customize->add_control( 'pfx_woo_btn_padding', array(
481
- 'priority' => 1,
482
- 'type' => 'number',
483
- 'section' => 'pfx_woo_btn',
484
- 'settings' => 'pfx_woo_btn_padding',
485
- 'label' => __( 'Button Padding ', 'popularfx' ),
486
- 'description' => __( 'Set button padding in px', 'popularfx' ),
487
- 'input_attrs' => array(
488
- 'min' => 0,
489
- 'max' => 30,
490
- 'step' => 1,
491
- ),
492
- )
493
  );
494
-
495
- $wp_customize->add_setting('pfx_woo_btn_bg_color', array(
496
- 'capability' => 'edit_theme_options',
497
- 'transport' => 'postMessage',
498
- 'default' => '#5c7aea',
499
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
500
- ) );
501
-
502
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
503
- $wp_customize, 'pfx_woo_btn_bg_color', array(
 
 
504
  'priority' => 2,
505
- 'section' => 'pfx_woo_btn',
506
- 'description' => 'Set background color for buttons',
507
- 'settings' => 'pfx_woo_btn_bg_color',
508
- 'label' => __('Button Background Color', 'popularfx' ),
509
- 'show_opacity' => true
510
- )
511
- ) );
512
-
513
- $wp_customize->add_setting('pfx_woo_btn_color', array(
514
- 'capability' => 'edit_theme_options',
515
- 'transport' => 'postMessage',
516
- 'default' => '#ffffff',
517
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
518
- ) );
519
-
520
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
521
- $wp_customize, 'pfx_woo_btn_color', array(
522
- 'priority' => 3,
523
- 'section' => 'pfx_woo_btn',
524
- 'description' => 'Set background color for buttons',
525
- 'settings' => 'pfx_woo_btn_color',
526
- 'label' => __('Button Text Color', 'popularfx' ),
527
- 'show_opacity' => true
528
- )
529
- ) );
530
-
531
- $wp_customize->add_setting('pfx_woo_btn_hover_bg_color', array(
532
- 'capability' => 'edit_theme_options',
533
- 'transport' => 'refresh',
534
- 'default' => '#000000',
535
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
536
- ) );
537
-
538
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
539
- $wp_customize, 'pfx_woo_btn_hover_bg_color', array(
540
- 'priority' => 4,
541
- 'section' => 'pfx_woo_btn',
542
- 'description' => 'Set hover background color for buttons',
543
- 'settings' => 'pfx_woo_btn_hover_bg_color',
544
- 'label' => __('Button Hover Background Color', 'popularfx' ),
545
- 'show_opacity' => true
546
- )
547
- ) );
548
-
549
- $wp_customize->add_setting('pfx_woo_btn_hover_color', array(
550
- 'capability' => 'edit_theme_options',
551
- 'transport' => 'refresh',
552
- 'default' => '#ffffff',
553
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
554
- ) );
555
-
556
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
557
- $wp_customize, 'pfx_woo_btn_hover_color', array(
558
- 'priority' => 5,
559
- 'section' => 'pfx_woo_btn',
560
- 'description' => 'Set hover text color for buttons',
561
- 'settings' => 'pfx_woo_btn_hover_color',
562
- 'label' => __('Button Hover Text Color', 'popularfx' ),
563
- 'show_opacity' => true
564
- )
565
- ) );
566
-
567
- $wp_customize->add_setting( 'pfx_woo_btn_border', array(
568
- 'capability' => 'edit_theme_options',
569
- 'transport' => 'postMessage',
570
- 'sanitize_callback' => 'absint',
571
- 'default' => 0,
572
- ) );
573
-
574
- $wp_customize->add_control( 'pfx_woo_btn_border', array(
575
- 'priority' => 6,
576
- 'type' => 'number',
577
- 'section' => 'pfx_woo_btn',
578
- 'settings' => 'pfx_woo_btn_border',
579
- 'label' => __( 'Button Border ', 'popularfx' ),
580
- 'description' => __( 'Set button borders in px', 'popularfx' ),
581
- 'input_attrs' => array(
582
- 'min' => 0,
583
- 'max' => 30,
584
- 'step' => 1,
585
- ),
586
- )
587
- );
588
-
589
- $wp_customize->add_setting( 'pfx_woo_btn_border_radius', array(
590
- 'capability' => 'edit_theme_options',
591
- 'transport' => 'postMessage',
592
- 'sanitize_callback' => 'absint',
593
- 'default' => 0,
594
- ) );
595
-
596
- $wp_customize->add_control( 'pfx_woo_btn_border_radius', array(
597
- 'priority' => 7,
598
- 'type' => 'number',
599
- 'section' => 'pfx_woo_btn',
600
- 'settings' => 'pfx_woo_btn_border_radius',
601
- 'label' => __( 'Button Border Radius', 'popularfx' ),
602
- 'description' => __( 'Set button borders radius in px', 'popularfx' ),
603
- 'input_attrs' => array(
604
- 'min' => 0,
605
- 'max' => 30,
606
- 'step' => 1,
607
- ),
608
- )
609
- );
610
-
611
- $wp_customize->add_setting('pfx_woo_btn_border_color', array(
612
- 'capability' => 'edit_theme_options',
613
- 'transport' => 'postMessage',
614
- 'default' => '#ffffff',
615
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
616
- ) );
617
-
618
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
619
- $wp_customize, 'pfx_woo_btn_border_color', array(
620
- 'priority' => 8,
621
- 'section' => 'pfx_woo_btn',
622
- 'description' => 'Set border color for buttons',
623
- 'settings' => 'pfx_woo_btn_border_color',
624
- 'label' => __('Button Border Color', 'popularfx' ),
625
- 'show_opacity' => true
626
- )
627
- ) );
628
-
629
- $wp_customize->add_setting( 'pfx_woo_btn_hover_border', array(
630
- 'capability' => 'edit_theme_options',
631
- 'transport' => 'refresh',
632
- 'sanitize_callback' => 'absint',
633
- 'default' => 0,
634
- ) );
635
-
636
- $wp_customize->add_control( 'pfx_woo_btn_hover_border', array(
637
- 'priority' => 9,
638
- 'type' => 'number',
639
- 'section' => 'pfx_woo_btn',
640
- 'settings' => 'pfx_woo_btn_hover_border',
641
- 'label' => __( 'Button Hover Border ', 'popularfx' ),
642
- 'description' => __( 'Set button hover borders in px', 'popularfx' ),
643
- 'input_attrs' => array(
644
- 'min' => 0,
645
- 'max' => 30,
646
- 'step' => 1,
647
- ),
648
- )
649
  );
650
-
651
- $wp_customize->add_setting( 'pfx_woo_btn_hover_border_radius', array(
652
- 'capability' => 'edit_theme_options',
653
- 'transport' => 'refresh',
654
- 'sanitize_callback' => 'absint',
655
- 'default' => 0,
656
- ) );
657
-
658
- $wp_customize->add_control( 'pfx_woo_btn_hover_border_radius', array(
659
- 'priority' => 10,
660
- 'type' => 'number',
661
- 'section' => 'pfx_woo_btn',
662
- 'settings' => 'pfx_woo_btn_hover_border_radius',
663
- 'label' => __( 'Button Hover Border Radius', 'popularfx' ),
664
- 'description' => __( 'Set button hover borders radius in px', 'popularfx' ),
665
- 'input_attrs' => array(
666
- 'min' => 0,
667
- 'max' => 30,
668
- 'step' => 1,
669
- ),
670
- )
671
  );
672
-
673
- $wp_customize->add_setting('pfx_woo_btn_hover_border_color', array(
674
  'capability' => 'edit_theme_options',
675
- 'transport' => 'refresh',
676
- 'default' => '#ffffff',
677
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
678
- ) );
679
 
680
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
681
- $wp_customize, 'pfx_woo_btn_hover_border_color', array(
682
- 'priority' => 11,
683
- 'section' => 'pfx_woo_btn',
684
- 'description' => 'Set hover border color for all buttons',
685
- 'settings' => 'pfx_woo_btn_hover_border_color',
686
- 'label' => __('Button Hover Border Color', 'popularfx' ),
687
- 'show_opacity' => true
688
  )
689
- ) );
690
-
691
- //Array for woo_padding
692
- $woo_padding = [];
693
- $woo_padding[0] = 'Default( ' .get_theme_mod('pfx_woo_default_padding'). 'px )';
694
- for($i = 1; $i <= 100; $i++){
695
- $woo_padding[$i] = esc_attr($i.'px');
696
- }
697
-
698
- // WooCommerce Shop Page Settings
699
- $wp_customize->add_setting('pfx_woo_shop_padding', array(
700
- 'capability' => 'edit_theme_options',
701
- 'transport' => 'refresh',
702
- 'default' => 0,
703
- 'sanitize_callback' => 'absint',
704
- ) );
705
 
706
- $wp_customize->add_control( 'pfx_woo_shop_padding', array(
707
- 'type' => 'select',
708
- 'priority' => 1,
709
- 'section' => 'woocommerce_product_catalog',
710
- 'description' => 'Set container padding for shop page in "px"',
711
- 'settings' => 'pfx_woo_shop_padding',
712
- 'label' => __('Shop Page Padding', 'popularfx' ),
713
- 'choices' => $woo_padding,
714
- ) );
715
-
716
- //Single Product Page Settings
717
- $wp_customize->add_setting('pfx_woo_product_padding', array(
718
- 'capability' => 'edit_theme_options',
719
- 'transport' => 'refresh',
720
- 'default' => 0,
721
- 'sanitize_callback' => 'absint',
722
- ) );
723
-
724
- $wp_customize->add_control( 'pfx_woo_product_padding', array(
725
- 'type' => 'select',
726
- 'priority' => 1,
727
- 'section' => 'pfx_woo_single_product',
728
- 'description' => 'Set container padding for single product page in "px"',
729
- 'settings' => 'pfx_woo_product_padding',
730
- 'label' => __('Single Product Page Padding', 'popularfx' ),
731
- 'choices' => $woo_padding,
732
- ) );
733
-
734
- $wp_customize->add_setting('disable_product_breadcrumb', array(
735
- 'capability' => 'edit_theme_options',
736
- 'transport' => 'refresh',
737
- 'default' => 0,
738
- 'sanitize_callback' => 'popularfx_switch_sanitization',
739
- ) );
740
-
741
- $wp_customize->add_control( 'disable_product_breadcrumb', array(
742
- 'type' => 'checkbox',
743
- 'section' => 'pfx_woo_single_product',
744
- 'settings' => 'disable_product_breadcrumb',
745
- 'label' => __('Disable Breadcrumb', 'popularfx' ),
746
- ) );
747
-
748
- $wp_customize->add_setting('product_image_width', array(
749
- 'capability' => 'edit_theme_options',
750
- 'transport' => 'refresh',
751
- 'default' => 48,
752
- ) );
753
-
754
- $wp_customize->add_control( 'product_image_width', array(
755
- 'type' => 'number',
756
- 'section' => 'pfx_woo_single_product',
757
- 'description' => 'Set image width of single product in "%" ',
758
- 'settings' => 'product_image_width',
759
- 'label' => __('Image Width', 'popularfx' ),
760
- 'input_attrs' => array(
761
- 'min' => 0,
762
- 'max' => 70,
763
- 'step' => 1,
764
  ),
765
- ) );
766
-
767
- $wp_customize->add_setting('enable_product_zoom', array(
768
- 'capability' => 'edit_theme_options',
769
- 'transport' => 'refresh',
770
- 'default' => 1,
771
- 'sanitize_callback' => 'popularfx_switch_sanitization',
772
- ) );
773
-
774
- $wp_customize->add_control( 'enable_product_zoom', array(
775
- 'type' => 'checkbox',
776
- 'section' => 'pfx_woo_single_product',
777
- 'settings' => 'enable_product_zoom',
778
- 'label' => __('Enable Image Zoom Effect', 'popularfx' ),
779
- ) );
780
 
781
- $wp_customize->add_setting('disable_product_description', array(
782
- 'capability' => 'edit_theme_options',
783
- 'transport' => 'refresh',
784
- 'default' => 0,
785
- 'sanitize_callback' => 'popularfx_switch_sanitization',
786
- ) );
 
787
 
788
- $wp_customize->add_control( 'disable_product_description', array(
789
- 'type' => 'checkbox',
790
- 'section' => 'pfx_woo_single_product',
791
- 'settings' => 'disable_product_description',
792
- 'label' => __('Hide Products Description', 'popularfx' ),
793
- ) );
 
794
 
795
- $wp_customize->add_setting('disable_upsells', array(
796
- 'capability' => 'edit_theme_options',
797
- 'transport' => 'refresh',
798
- 'default' => 0,
799
- 'sanitize_callback' => 'popularfx_switch_sanitization',
800
- ) );
801
 
802
- $wp_customize->add_control( 'disable_upsells', array(
803
- 'type' => 'checkbox',
804
- 'section' => 'pfx_woo_single_product',
805
- 'settings' => 'disable_upsells',
806
- 'label' => __('Disable Products Up Sells', 'popularfx' ),
807
- ) );
 
808
 
809
- $wp_customize->add_setting('disable_related_product', array(
810
- 'capability' => 'edit_theme_options',
811
- 'transport' => 'refresh',
812
- 'default' => 0,
813
- 'sanitize_callback' => 'popularfx_switch_sanitization',
814
- ) );
815
 
816
- $wp_customize->add_control( 'disable_related_product', array(
817
- 'type' => 'checkbox',
818
- 'section' => 'pfx_woo_single_product',
819
- 'settings' => 'disable_related_product',
820
- 'label' => __('Disable Related Products', 'popularfx' ),
821
- ) );
 
822
 
823
- $wp_customize->add_setting('number_related_product', array(
 
 
 
 
 
824
  'capability' => 'edit_theme_options',
 
825
  'transport' => 'refresh',
826
- 'default' => 4,
827
- 'sanitize_callback' => 'absint',
828
- ) );
829
-
830
- $wp_customize->add_control( 'number_related_product', array(
831
- 'type' => 'number',
832
- 'section' => 'pfx_woo_single_product',
833
- 'description' => 'Set number of product in related products',
834
- 'settings' => 'number_related_product',
835
- 'label' => __('No. of Related Products', 'popularfx' ),
836
- 'input_attrs' => array(
837
- 'min' => 1,
838
- 'max' => 5,
839
- 'step' => 1,
840
  ),
841
- ) );
842
 
843
- $wp_customize->add_setting('product_title_color', array(
 
 
 
 
 
844
  'capability' => 'edit_theme_options',
845
- 'transport' => 'postMessage',
 
846
  'default' => '',
847
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
848
- ) );
849
-
850
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
851
- $wp_customize, 'product_title_color', array(
852
- 'section' => 'pfx_woo_single_product',
853
- 'settings' => 'product_title_color',
854
- 'label' => __('Title Color', 'popularfx' ),
855
- 'show_opacity' => true
856
- )
857
- ) );
 
858
 
859
- $wp_customize->add_setting('product_price_color', array(
860
- 'capability' => 'edit_theme_options',
861
- 'transport' => 'postMessage',
862
- 'default' => '',
863
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
864
- ) );
 
865
 
866
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
867
- $wp_customize, 'product_price_color', array(
868
- 'section' => 'pfx_woo_single_product',
869
- 'settings' => 'product_price_color',
870
- 'label' => __('Price Color', 'popularfx' ),
871
- 'show_opacity' => true
872
- )
873
- ) );
874
 
875
- $wp_customize->add_setting('product_description_color', array(
 
 
 
 
876
  'capability' => 'edit_theme_options',
877
- 'transport' => 'postMessage',
 
878
  'default' => '',
879
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
880
- ) );
881
-
882
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
883
- $wp_customize, 'product_description_color', array(
884
- 'section' => 'pfx_woo_single_product',
885
- 'settings' => 'product_description_color',
886
- 'label' => __('Description Color', 'popularfx' ),
887
- 'show_opacity' => true
888
- )
889
- ) );
 
890
 
891
- $wp_customize->add_setting('product_breadcrumb_color', array(
892
- 'capability' => 'edit_theme_options',
893
- 'transport' => 'postMessage',
894
- 'default' => '',
895
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
896
- ) );
 
897
 
898
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
899
- $wp_customize, 'product_breadcrumb_color', array(
900
- 'section' => 'pfx_woo_single_product',
901
- 'settings' => 'product_breadcrumb_color',
902
- 'label' => __('Breadcrumb Color', 'popularfx' ),
903
- 'show_opacity' => true
904
  )
905
- ) );
906
-
907
- // Cart Page Settings
908
- $wp_customize->add_setting('pfx_woo_cart_padding', array(
909
- 'capability' => 'edit_theme_options',
910
- 'transport' => 'refresh',
911
- 'default' => 0,
912
- 'sanitize_callback' => 'absint',
913
- ) );
914
-
915
- $wp_customize->add_control( 'pfx_woo_cart_padding', array(
916
- 'type' => 'select',
917
- 'priority' => 1,
918
- 'section' => 'pfx_woo_cart_page',
919
- 'description' => 'Set container padding for cart page in "px"',
920
- 'settings' => 'pfx_woo_cart_padding',
921
- 'label' => __('Cart Page Padding', 'popularfx' ),
922
- 'choices' => $woo_padding,
923
- ) );
924
-
925
- $wp_customize->add_setting('disable_cross_sells', array(
926
- 'capability' => 'edit_theme_options',
927
- 'transport' => 'postMessage',
928
- 'default' => 0,
929
- 'sanitize_callback' => 'popularfx_switch_sanitization',
930
- ) );
931
-
932
- $wp_customize->add_control( 'disable_cross_sells', array(
933
- 'type' => 'checkbox',
934
- 'section' => 'pfx_woo_cart_page',
935
- 'settings' => 'disable_cross_sells',
936
- 'label' => __('Disable Cross-sells', 'popularfx' ),
937
- ) );
938
-
939
- //Checkout Page Settings
940
- $wp_customize->add_setting('pfx_woo_checkout_padding', array(
941
- 'capability' => 'edit_theme_options',
942
- 'transport' => 'refresh',
943
- 'default' => 0,
944
- 'sanitize_callback' => 'absint',
945
- ) );
946
-
947
- $wp_customize->add_control( 'pfx_woo_checkout_padding', array(
948
- 'type' => 'select',
949
- 'priority' => 1,
950
- 'section' => 'woocommerce_checkout',
951
- 'description' => 'Set container padding for checkout page in "%"',
952
- 'settings' => 'pfx_woo_checkout_padding',
953
- 'label' => __('Checkout Page Padding', 'popularfx' ),
954
- 'choices' => $woo_padding,
955
- ) );
956
-
957
- $wp_customize->add_setting('disable_order_note', array(
958
- 'capability' => 'edit_theme_options',
959
- 'transport' => 'postMessage',
960
- 'default' => 0,
961
- 'sanitize_callback' => 'popularfx_switch_sanitization',
962
- ) );
963
-
964
- $wp_customize->add_control( 'disable_order_note', array(
965
- 'type' => 'checkbox',
966
- 'section' => 'woocommerce_checkout',
967
- 'settings' => 'disable_order_note',
968
- 'label' => __('Disable Order Note', 'popularfx' ),
969
- ) );
970
-
971
- $wp_customize->add_setting('disable_coupon_field', array(
972
- 'capability' => 'edit_theme_options',
973
- 'transport' => 'postMessage',
974
- 'default' => 0,
975
- 'sanitize_callback' => 'popularfx_switch_sanitization',
976
- ) );
977
-
978
- $wp_customize->add_control( 'disable_coupon_field', array(
979
- 'type' => 'checkbox',
980
- 'section' => 'woocommerce_checkout',
981
- 'settings' => 'disable_coupon_field',
982
- 'label' => __('Disable Coupon Field', 'popularfx' ),
983
- ) );
984
-
985
- $wp_customize->add_setting('enable_label_placeholder', array(
986
- 'capability' => 'edit_theme_options',
987
- 'transport' => 'refresh',
988
- 'default' => 1,
989
- 'sanitize_callback' => 'popularfx_switch_sanitization',
990
- ) );
991
-
992
- $wp_customize->add_control( 'enable_label_placeholder', array(
993
- 'type' => 'checkbox',
994
- 'section' => 'woocommerce_checkout',
995
- 'settings' => 'enable_label_placeholder',
996
- 'label' => __('Show Label as Placeholder', 'popularfx' ),
997
- ) );
998
 
999
- //My Account Page Settings
1000
- $wp_customize->add_setting('pfx_woo_myaccount_padding', array(
 
 
 
 
1001
  'capability' => 'edit_theme_options',
 
1002
  'transport' => 'refresh',
1003
- 'default' => 0,
1004
- 'sanitize_callback' => 'absint',
1005
- ) );
1006
-
1007
- $wp_customize->add_control( 'pfx_woo_myaccount_padding', array(
1008
- 'type' => 'select',
1009
- 'priority' => 1,
1010
- 'section' => 'pfx_woo_myaccount_page',
1011
- 'description' => 'Set container padding for Myaccount page in "px"',
1012
- 'settings' => 'pfx_woo_myaccount_padding',
1013
- 'label' => __('Myaccount Page Padding', 'popularfx' ),
1014
- 'choices' => $woo_padding,
1015
- ) );
1016
-
1017
- // Store Notice design
1018
- $wp_customize->add_setting('pfx_woo_storenotice_bg_color', array(
1019
- 'capability' => 'edit_theme_options',
1020
- 'transport' => 'postMessage',
1021
- 'default' => '#5c7aea',
1022
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1023
- ) );
1024
-
1025
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1026
- $wp_customize, 'pfx_woo_storenotice_bg_color', array(
1027
- 'section' => 'woocommerce_store_notice',
1028
- 'description' => 'Set background color for store notice',
1029
- 'settings' => 'pfx_woo_storenotice_bg_color',
1030
- 'label' => __('Background color', 'popularfx' ),
1031
- 'show_opacity' => true
1032
- )
1033
- ) );
1034
-
1035
- $wp_customize->add_setting('pfx_woo_storenotice_color', array(
1036
- 'capability' => 'edit_theme_options',
1037
- 'transport' => 'postMessage',
1038
- 'default' => '#FFFFFF',
1039
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1040
- ) );
1041
-
1042
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1043
- $wp_customize, 'pfx_woo_storenotice_color', array(
1044
- 'section' => 'woocommerce_store_notice',
1045
- 'description' => 'Set text color for store notice',
1046
- 'settings' => 'pfx_woo_storenotice_color',
1047
- 'label' => __('Text Color', 'popularfx' ),
1048
- 'show_opacity' => true
1049
- )
1050
- ) );
1051
-
1052
- //Shop Pagination setting
1053
- $wp_customize->add_setting('shoppagination_bg_color', array(
1054
- 'capability' => 'edit_theme_options',
1055
- 'transport' => 'postMessage',
1056
- 'default' => '#ffffff',
1057
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1058
- ) );
1059
-
1060
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1061
- $wp_customize, 'shoppagination_bg_color', array(
1062
- 'section' => 'pfx_woo_shop_pagination',
1063
- 'description' => 'Set background color for pagination',
1064
- 'settings' => 'shoppagination_bg_color',
1065
- 'label' => __('Background Color', 'popularfx' ),
1066
- 'show_opacity' => true
1067
- )
1068
- ) );
1069
-
1070
- $wp_customize->add_setting('shoppagination_color', array(
1071
- 'capability' => 'edit_theme_options',
1072
- 'transport' => 'postMessage',
1073
- 'default' => '#000000',
1074
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1075
- ) );
1076
-
1077
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1078
- $wp_customize, 'shoppagination_color', array(
1079
- 'section' => 'pfx_woo_shop_pagination',
1080
- 'description' => 'Set text color for pagination',
1081
- 'settings' => 'shoppagination_color',
1082
- 'label' => __('Text Color', 'popularfx' ),
1083
- 'show_opacity' => true
1084
- )
1085
- ) );
1086
-
1087
- $wp_customize->add_setting('shoppagination_border_color', array(
1088
- 'capability' => 'edit_theme_options',
1089
- 'transport' => 'postMessage',
1090
- 'default' => '#ffffff',
1091
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1092
- ) );
1093
-
1094
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1095
- $wp_customize, 'shoppagination_border_color', array(
1096
- 'section' => 'pfx_woo_shop_pagination',
1097
- 'description' => 'Set border color for pagination',
1098
- 'settings' => 'shoppagination_border_color',
1099
- 'label' => __('Border Color', 'popularfx' ),
1100
- 'show_opacity' => true
1101
- )
1102
- ) );
1103
-
1104
- $wp_customize->add_setting( 'shoppagination_borderwidth', array(
1105
- 'capability' => 'edit_theme_options',
1106
- 'transport' => 'postMessage',
1107
- 'default' => 1,
1108
- 'sanitize_callback' => 'absint',
1109
- ) );
1110
-
1111
- $wp_customize->add_control( 'shoppagination_borderwidth', array(
1112
- 'type' => 'number',
1113
- 'section' => 'pfx_woo_shop_pagination',
1114
- 'settings' => 'shoppagination_borderwidth',
1115
- 'label' => __( 'Pagination Border Width', 'popularfx' ),
1116
- 'description' => __( 'Set shop page pagination border width', 'popularfx' ),
1117
- 'input_attrs' => array(
1118
- 'min' => 0,
1119
- 'max' => 10,
1120
- 'step' => 1,
1121
- ),
1122
- ) );
1123
-
1124
- $wp_customize->add_setting( 'shoppagination_borderradius', array(
1125
- 'capability' => 'edit_theme_options',
1126
- 'transport' => 'postMessage',
1127
- 'default' => 0,
1128
- 'sanitize_callback' => 'absint',
1129
- ) );
1130
-
1131
- $wp_customize->add_control( 'shoppagination_borderradius', array(
1132
- 'type' => 'number',
1133
- 'section' => 'pfx_woo_shop_pagination',
1134
- 'settings' => 'shoppagination_borderradius',
1135
- 'label' => __( 'Border Radius', 'popularfx' ),
1136
- 'description' => __( 'Set pagination border radius in %', 'popularfx' ),
1137
- 'input_attrs' => array(
1138
- 'min' => 0,
1139
- 'max' => 100,
1140
- 'step' => 1,
1141
  ),
1142
- ) );
1143
 
1144
- $wp_customize->add_setting('shoppagination_bg_hover_color', array(
1145
- 'capability' => 'edit_theme_options',
1146
- 'transport' => 'refresh',
1147
- 'default' => '#000000',
1148
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1149
- ) );
 
1150
 
1151
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1152
- $wp_customize, 'shoppagination_bg_hover_color', array(
1153
- 'section' => 'pfx_woo_shop_pagination',
1154
- 'description' => 'Set hover background color for pagination',
1155
- 'settings' => 'shoppagination_bg_hover_color',
1156
- 'label' => __('Hover Background Color', 'popularfx' ),
1157
- 'show_opacity' => true
1158
- )
1159
- ) );
1160
 
1161
- $wp_customize->add_setting('shoppagination_hover_color', array(
1162
- 'capability' => 'edit_theme_options',
1163
- 'transport' => 'refresh',
1164
- 'default' => '#ffffff',
1165
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1166
- ) );
 
1167
 
1168
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1169
- $wp_customize, 'shoppagination_hover_color', array(
1170
- 'section' => 'pfx_woo_shop_pagination',
1171
- 'description' => 'Set hover text color for pagination',
1172
- 'settings' => 'shoppagination_hover_color',
1173
- 'label' => __('Hover Text Color', 'popularfx' ),
1174
- 'show_opacity' => true
1175
  )
1176
- ) );
1177
 
1178
- $wp_customize->add_setting('shoppagination_hover_border_color', array(
 
 
 
 
 
1179
  'capability' => 'edit_theme_options',
 
1180
  'transport' => 'refresh',
1181
- 'default' => '#000000',
1182
- 'sanitize_callback' => 'popularfx_hex_rgba_sanitization',
1183
- ) );
1184
-
1185
- $wp_customize->add_control( new Popularfx_Customize_Alpha_Color_Control(
1186
- $wp_customize, 'shoppagination_hover_border_color', array(
1187
- 'section' => 'pfx_woo_shop_pagination',
1188
- 'description' => 'Set hover border color for pagination',
1189
- 'settings' => 'shoppagination_hover_border_color',
1190
- 'label' => __('Hover Border Color', 'popularfx' ),
1191
- 'show_opacity' => true
1192
- )
1193
- ) );
1194
-
1195
  }
22
  exit('Hacking Attempt !');
23
  }
24
 
25
+ add_action( 'wp', 'pagelayer_wc_customization' );
26
+ function pagelayer_wc_customization(){
 
 
 
 
 
27
 
28
+ $options = pagelayer_get_customize_options();
29
 
30
+ if(!empty($options['woo_disable_cross_sells'])){
31
+ remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
32
+ }
 
 
 
 
 
33
 
34
+ if(is_product()){
35
+ // Disable Breadcrumb.
36
+ if(!empty($options['woo_disable_breadcrumb'])){
37
+ remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  }
39
+ }
40
+
41
+ // Checkout customization
42
+ if(!is_checkout()){
43
+ return;
44
+ }
45
 
46
+ // Disable order notes.
47
+ if(!empty( $options['woo_disable_order_note'] )){
48
+ add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
49
  }
50
 
51
+ // Disable coupon.
52
+ if(!empty( $options['woo_disable_coupon_field'] )){
53
+ remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
54
+ }
55
  }
56
 
57
+ add_filter('wp_nav_menu_items', 'pagelayer_add_woo_cart', 10, 2);
58
+ add_filter('wp_page_menu', 'pagelayer_add_woo_cart', 10, 2);
59
+ function pagelayer_add_woo_cart($items, $args) {
60
+
61
+ $options = pagelayer_get_customize_options();
62
 
63
+ if( $options['woo_enable_menu_cart'] ) {
64
+ $items .= '<li class="page-item pagelayer-menu-cart cart-customlocation menu-item menu-item-type-post_type menu-item-object-page"><a href=""><span class="dashicons dashicons-cart"></span><sup></sup></a></li>';
65
+ }
66
 
67
+ return $items;
 
68
  }
69
 
70
+ add_action( 'customize_controls_print_scripts', 'pagelayer_wc_add_scripts' );
71
+ function pagelayer_wc_add_scripts(){
72
  ?>
73
  <script>
74
 
75
  // Script to load Shop page when user click woocommerce customizer
76
  jQuery( function( $ ) {
77
+ wp.customize.panel( 'pgl_woocommerce', function( panel ) {
78
  panel.expanded.bind( function( isExpanded ) {
79
  if ( isExpanded ) {
80
+ wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>" );
81
  }
82
  } );
83
  } );
84
+ wp.customize.section( 'pgl_woo_cart_page', function( section ) {
85
+ section.expanded.bind( function( isExpanded ) {
86
+ if( isExpanded ){
87
+ wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'cart' ) ); ?>" );
88
+ }
89
+ } );
90
+ } );
91
+ wp.customize.section( 'pgl_woo_checkout', function( section ) {
92
  section.expanded.bind( function( isExpanded ) {
93
  if ( isExpanded ) {
94
+ wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'checkout' ) ); ?>" );
95
  }
96
  } );
97
  } );
98
+ wp.customize.section( 'pgl_woo_myaccount_page', function( section ) {
99
  section.expanded.bind( function( isExpanded ) {
100
  if ( isExpanded ) {
101
+ wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'myaccount' ) ); ?>" );
102
  }
103
  } );
104
  } );
105
+ wp.customize.section( 'pgl_woo_product_catalog', function( section ) {
106
  section.expanded.bind( function( isExpanded ) {
107
  if ( isExpanded ) {
108
+ wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>" );
109
  }
110
  } );
111
  } );
112
+ wp.customize.section( 'pgl_woo_general', function( section ) {
113
  section.expanded.bind( function( isExpanded ) {
114
  if ( isExpanded ) {
115
+ wp.customize.previewer.previewUrl.set( "<?php echo esc_js( wc_get_page_permalink( 'shop' ) ); ?>" );
116
  }
117
  } );
118
  } );
120
  </script>
121
  <?php
122
  }
123
+ function pagelayer_parse_customize_styles($val, $rule, $unit = 'px'){
 
 
 
 
124
 
125
+ $parse = str_replace(array('{{val}}', '{{color}}', '{{unit}}'), array($val, pagelayer_sanitize_global_color($val), $unit), $rule);
126
+ $parse = rtrim( trim($parse), ';' );
 
 
 
 
 
127
 
128
+ return $parse;
129
+ }
130
+
131
+ add_action( 'wp_head', 'pagelayer_woocommerce_styles', 1000 );
132
+ function pagelayer_woocommerce_styles(){
133
+ global $pagelayer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
+ // Get the option defaults
136
+ $options = pagelayer_get_customize_options();
137
+ $modes = array('desktop', 'tablet', 'mobile');
138
+ $css = array();
139
 
140
+ $woo_styles = array(
141
+ 'woo_notice_bg_color' => array(
142
+ '.woocommerce-store-notice.demo_store' => 'background-color: {{color}}',
143
+ ),
144
+ 'woo_notice_color' => array(
145
+ '.woocommerce-store-notice.demo_store' => 'color: {{color}}',
146
+ ),
147
+ 'woo_notice_a_color' => array(
148
+ '.woocommerce-store-notice.demo_store a' => 'color: {{color}}',
149
+ ),
150
+ 'woo_notice_a_hover_color' => array(
151
+ '.woocommerce-store-notice.demo_store a:hover' => 'color: {{color}}',
152
+ ),
153
+ 'woo_myaccount_padding' => array(
154
+ 'body.woocommerce-account main.site-main' => array(
155
+ 'top' => 'padding-top: {{val}}{{unit}};',
156
+ 'right' => 'padding-right: {{val}}{{unit}};',
157
+ 'bottom' => 'padding-bottom: {{val}}{{unit}};',
158
+ 'left' => 'padding-left: {{val}}{{unit}};'
159
+ )
160
+ ),
161
+ 'woo_checkout_padding' => array(
162
+ 'body.woocommerce-checkout main.site-main' => array(
163
+ 'top' => 'padding-top: {{val}}{{unit}};',
164
+ 'right' => 'padding-right: {{val}}{{unit}};',
165
+ 'bottom' => 'padding-bottom: {{val}}{{unit}};',
166
+ 'left' => 'padding-left: {{val}}{{unit}};'
167
+ )
168
+ ),
169
+ 'woo_cart_padding' => array(
170
+ 'body.woocommerce-cart main.site-main' => array(
171
+ 'top' => 'padding-top: {{val}}{{unit}};',
172
+ 'right' => 'padding-right: {{val}}{{unit}};',
173
+ 'bottom' => 'padding-bottom: {{val}}{{unit}};',
174
+ 'left' => 'padding-left: {{val}}{{unit}};'
175
+ )
176
+ ),
177
+ 'woo_product_padding' => array(
178
+ 'body.single-product main.site-main' => array(
179
+ 'top' => 'padding-top: {{val}}{{unit}};',
180
+ 'right' => 'padding-right: {{val}}{{unit}};',
181
+ 'bottom' => 'padding-bottom: {{val}}{{unit}};',
182
+ 'left' => 'padding-left: {{val}}{{unit}};'
183
+ )
184
+ ),
185
+ 'woo_product_cat_padding' => array(
186
+ 'body.post-type-archive-product .site-main' => array(
187
+ 'top' => 'padding-top: {{val}}{{unit}};',
188
+ 'right' => 'padding-right: {{val}}{{unit}};',
189
+ 'bottom' => 'padding-bottom: {{val}}{{unit}};',
190
+ 'left' => 'padding-left: {{val}}{{unit}};'
191
+ )
192
+ ),
193
+ 'woo_menu_cart_color' => array(
194
+ 'li.cart-customlocation span.dashicons-cart' => 'color: {{color}};',
195
+ ),
196
+ 'woo_menu_cart_number_color' => array(
197
+ 'li.cart-customlocation span.dashicons-cart + sup' => 'color: {{color}};',
198
+ )
199
+ );
200
 
201
+ $woo_styles = apply_filters('pagelayer_wc_styles_array', $woo_styles);
 
 
 
 
202
 
203
+ // Apply customizer css
204
+ foreach($woo_styles as $key => $rules){
205
+
206
+ $value = $options[$key];
207
+
208
+ if(empty($value) && $value != '0'){
209
+ continue;
210
+ }
211
+
212
+ foreach($rules as $sel => $rule){
213
+
214
+ // Is not reponsive or not variable value?
215
+ if(!is_array($value)){
216
+ $css['desktop'][$sel][] = pagelayer_parse_customize_styles($value, $rule);
217
+ continue;
218
+ }
219
+
220
+ // If unit exists
221
+ $unit = !empty($value['unit'])? $value['unit'] : 'px';
222
+
223
+ // Parse in array if responsive rule in string
224
+ $rule = (array) $rule;
225
+
226
+ foreach($rule as $kk => $_rule){
227
+
228
+ // Is not reponsive or not variable value?
229
+ if(isset($value[$kk]) && !is_array($value[$kk])){
230
+
231
+ if(empty($value[$kk]) && $value[$kk] != '0'){
232
+ continue;
233
+ }
234
+
235
+ $css['desktop'][$sel][] = pagelayer_parse_customize_styles($value[$kk], $_rule, $unit);
236
+ }
237
+
238
+ foreach($modes as $mode){
239
+
240
+ // First level responsive key
241
+ if(isset($value[$mode])){
242
+
243
+ // Responsive without variable
244
+ $mode_val = is_numeric($kk) ? $value[$mode] : $value[$mode][$kk] ;
245
+
246
+ if(empty($mode_val) && $mode_val != '0'){
247
+ continue;
248
+ }
249
+
250
+ $css[$mode][$sel][] = pagelayer_parse_customize_styles($mode_val, $_rule, $unit);
251
+
252
+ // We are already in responsive mode
253
+ continue;
254
+ }
255
+
256
+ // Second level responsive key like font size
257
+ if(empty($value[$kk][$mode]) && $value[$kk][$mode] != '0'){
258
+ continue;
259
+ }
260
+
261
+ $css[$mode][$sel][] = pagelayer_parse_customize_styles($value[$kk][$mode], $_rule, $unit);
262
+ }
263
+ }
264
+ }
265
+ }
266
 
267
+ // Create css
268
+ $screen_css = array('desktop' => '', 'tablet' => '', 'mobile' => '');
269
+ foreach($css as $mode => $_css){
270
+ foreach($_css as $selector => $val){
271
+ $parsr_style = $selector.'{'.implode(';', $val)."}\n";
272
+ $screen_css[$mode] .= $parsr_style;
273
+ }
274
+ }
275
 
276
+ $styles = '<style id="pagelayer-woocommerce-styles" type="text/css">'.PHP_EOL;
277
+ $styles .= $screen_css['desktop'];
278
 
279
+ if(!empty($screen_css['woo_product_image_width'])){
280
+ $styles .= '@media(min-width: 902px) {.woocommerce #content div.product div.images, .woocommerce div.product div.images, .woocommerce-page #content div.product div.images, .woocommerce-page div.product div.images{
281
+ width: '.$options['woo_product_image_width'].'% !important;
282
+ }
283
+ .woocommerce #content div.product div.summary, .woocommerce div.product div.summary, .woocommerce-page #content div.product div.summary, .woocommerce-page div.product div.summary{
284
+ width: calc(96% - '.$options['woo_product_image_width'].'%) !important;
285
+ }}';
286
+ }
287
 
288
+ if(!empty($screen_css['tablet'])){
289
+ $styles .= '@media(max-width: ' . $pagelayer->settings['tablet_breakpoint'] . 'px) {'.$screen_css['tablet'].'}'.PHP_EOL;
290
+ }
291
 
292
+ if(!empty($screen_css['mobile'])){
293
+ $styles .= '@media(max-width: ' . $pagelayer->settings['mobile_breakpoint'] . 'px) {'.$screen_css['mobile'].'}';
294
+ }
 
295
 
296
+ $styles .= '</style>';
297
 
298
  echo $styles;
299
  }
300
 
301
+ // Get Option Values
302
+ function pagelayer_get_customize_options(){
303
+ return get_option('pagelayer_customizer_options', array());
304
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
 
306
+ add_action( 'customize_register', 'pagelayer_woo_customize_register', 11 );
307
+ function pagelayer_woo_customize_register( $wp_customize ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
 
309
+ //PageLayer + WooCommerce Panel
310
+ $wp_customize->add_panel( 'pgl_woocommerce', array(
311
+ 'priority' => 10,
312
+ 'title' => __('Pagelayer + WooCommerce'),
313
+ ) );
314
+
315
+ // Add Store Notice Section
316
+ $wp_customize->get_section( 'woocommerce_store_notice' )->description = '<strong><a href="customize.php?autofocus[section]=pgl_woo_store_notice">'.__('Click here') .'</a> '. __('to change color scheme of store notice') .'</strong>';
317
+
318
+ // Add Store Notice Section
319
+ $wp_customize->add_section( 'pgl_woo_store_notice', array(
320
+ 'panel' => 'pgl_woocommerce',
321
+ 'priority' => 1,
322
+ 'title' => __('Store Notice'),
323
+ 'description' => '<strong><a href="customize.php?autofocus[section]=woocommerce_store_notice">'.__('Click here') .'</a> '. __('to enable the store notice') .'</strong>',
324
  ),
325
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
 
327
+ // Adds Customizer settings
328
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_bg_color]', array(
329
+ 'type' => 'option',
330
+ 'capability' => 'edit_theme_options',
331
+ 'transport' => 'refresh',
 
 
 
 
 
 
 
 
 
 
 
 
332
  ),
333
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
+ $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_notice_bg_color]', array(
336
+ 'label' => __('Background Color'),
337
+ 'section' => 'pgl_woo_store_notice',
338
+ 'priority' => 1
339
+ ) )
340
+ );
341
 
342
+ // Adds Customizer settings
343
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_color]', array(
344
+ 'type' => 'option',
345
+ 'capability' => 'edit_theme_options',
346
+ 'transport' => 'refresh',
347
+ ),
348
+ );
 
 
349
 
350
+ $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_notice_color]', array(
351
+ 'label' => __('Text Color'),
352
+ 'section' => 'pgl_woo_store_notice',
353
+ 'priority' => 1
354
+ ) )
355
+ );
356
+
357
+ // Adds Customizer settings
358
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_a_color]', array(
359
+ 'type' => 'option',
360
+ 'capability' => 'edit_theme_options',
361
+ 'transport' => 'refresh',
362
+ ),
363
+ );
364
 
365
+ $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_notice_a_color]', array(
366
+ 'label' => __('Link Color'),
367
+ 'section' => 'pgl_woo_store_notice',
368
+ 'priority' => 1
369
+ ) )
370
+ );
371
+
372
+ // Adds Customizer settings
373
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_notice_a_hover_color]', array(
374
+ 'type' => 'option',
375
+ 'capability' => 'edit_theme_options',
376
+ 'transport' => 'refresh',
377
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  );
379
+
380
+ $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_notice_a_hover_color]', array(
381
+ 'label' => __('Link Hover Color'),
382
+ 'section' => 'pgl_woo_store_notice',
383
+ 'priority' => 1
384
+ ) )
385
+ );
386
+
387
+ // Add Store Notice Section
388
+ $wp_customize->add_section( 'pgl_woo_general', array(
389
+ 'panel' => 'pgl_woocommerce',
390
+ 'title' => __('General'),
391
  'priority' => 2,
392
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  );
394
+
395
+ // Adds Customizer settings
396
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_star_rating_color]', array(
397
+ 'type' => 'option',
398
+ 'capability' => 'edit_theme_options',
399
+ 'transport' => 'refresh',
400
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  );
402
+
403
+ $wp_customize->add_setting( 'pagelayer_lable_menu_cart', array(
404
  'capability' => 'edit_theme_options',
405
+ ));
 
 
 
406
 
407
+ $wp_customize->add_control( new Pagelayer_Customize_Control(
408
+ $wp_customize, 'pagelayer_lable_menu_cart', array(
409
+ 'type' => 'hidden',
410
+ 'section' => 'pgl_woo_general',
411
+ 'description' => __('<div class="pagelayer-customize-heading"><div>Cart Icon on Menu</div></div>', 'pagelayer'),
412
+ 'li_class' => 'pagelayer-accordion-tab',
413
+ 'priority' => 9
 
414
  )
415
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
 
417
+ // Adds Customizer settings
418
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_enable_menu_cart]', array(
419
+ 'type' => 'option',
420
+ 'capability' => 'edit_theme_options',
421
+ 'transport' => 'refresh',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  ),
423
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
 
425
+ $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_enable_menu_cart]', array(
426
+ 'type' => 'checkbox',
427
+ 'label' => __('Show Cart Icon'),
428
+ 'section' => 'pgl_woo_general',
429
+ 'priority' => 9
430
+ ))
431
+ );
432
 
433
+ // Adds Customizer settings
434
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_menu_cart_color]', array(
435
+ 'type' => 'option',
436
+ 'capability' => 'edit_theme_options',
437
+ 'transport' => 'refresh'
438
+ ),
439
+ );
440
 
441
+ $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_menu_cart_color]', array(
442
+ 'label' => __('Icon Color'),
443
+ 'section' => 'pgl_woo_general',
444
+ 'priority' => 10,
445
+ ) )
446
+ );
447
 
448
+ // Adds Customizer settings
449
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_menu_cart_number_color]', array(
450
+ 'type' => 'option',
451
+ 'capability' => 'edit_theme_options',
452
+ 'transport' => 'refresh'
453
+ ),
454
+ );
455
 
456
+ $wp_customize->add_control( new Pagelayer_Customize_Alpha_Color_Control( $wp_customize, 'pagelayer_customizer_options[woo_menu_cart_number_color]', array(
457
+ 'label' => __('Cart Numbers Color'),
458
+ 'section' => 'pgl_woo_general',
459
+ 'priority' => 10,
460
+ ) )
461
+ );
462
 
463
+ // Shop Page Section
464
+ $wp_customize->add_section( 'pgl_woo_product_catalog', array(
465
+ 'panel' => 'pgl_woocommerce',
466
+ 'title' => __('Product Catalog'),
467
+ 'priority' => 4,
468
+ ),
469
+ );
470
 
471
+ // Register the WooCommerce Default Padding
472
+ pagelayer_register_padding_customizer_control($wp_customize, array(
473
+ 'control' => 'pagelayer_customizer_options',
474
+ 'control_array_sufix' => 'woo_product_cat_padding',
475
+ 'section' => 'pgl_woo_product_catalog',
476
+ 'label' => __( 'Padding', 'pagelayer' ),
477
  'capability' => 'edit_theme_options',
478
+ 'setting_type' => 'option',
479
  'transport' => 'refresh',
480
+ 'default' => '',
481
+ 'units' => ['px', 'em', '%'],
482
+ 'responsive' => 1,
483
+ 'priority' => 1
484
+ ), true);
485
+
486
+ // Single Product Page Sections
487
+ $wp_customize->add_section( 'pgl_woo_single_product', array(
488
+ 'panel' => 'pgl_woocommerce',
489
+ 'title' => __('Single Product'),
490
+ 'priority' => 5,
 
 
 
491
  ),
492
+ );
493
 
494
+ // Register the WooCommerce single page Padding
495
+ pagelayer_register_padding_customizer_control($wp_customize, array(
496
+ 'control' => 'pagelayer_customizer_options',
497
+ 'control_array_sufix' => 'woo_product_padding',
498
+ 'section' => 'pgl_woo_single_product',
499
+ 'label' => __( 'Padding', 'pagelayer' ),
500
  'capability' => 'edit_theme_options',
501
+ 'setting_type' => 'option',
502
+ 'transport' => 'refresh',
503
  'default' => '',
504
+ 'units' => ['px', 'em', '%'],
505
+ 'responsive' => 1,
506
+ 'priority' => 1
507
+ ), true);
508
+
509
+ // Single Product Page Breadcrumb Enabler
510
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_breadcrumb]', array(
511
+ 'type' => 'option',
512
+ 'capability' => 'edit_theme_options',
513
+ 'transport' => 'refresh',
514
+ ),
515
+ );
516
 
517
+ $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_breadcrumb]', array(
518
+ 'type' => 'checkbox',
519
+ 'label' => __('Disable Breadcrumb'),
520
+ 'section' => 'pgl_woo_single_product',
521
+ 'priority' => 5
522
+ ))
523
+ );
524
 
525
+ // Cart page settings
526
+ $wp_customize->add_section( 'pgl_woo_cart_page', array(
527
+ 'panel' => 'pgl_woocommerce',
528
+ 'title' => __('Cart'),
529
+ 'priority' => 7,
530
+ ),
531
+ );
 
532
 
533
+ pagelayer_register_padding_customizer_control($wp_customize, array(
534
+ 'control' => 'pagelayer_customizer_options',
535
+ 'control_array_sufix' => 'woo_cart_padding',
536
+ 'section' => 'pgl_woo_cart_page',
537
+ 'label' => __( 'Padding', 'pagelayer' ),
538
  'capability' => 'edit_theme_options',
539
+ 'setting_type' => 'option',
540
+ 'transport' => 'refresh',
541
  'default' => '',
542
+ 'units' => ['px', 'em', '%'],
543
+ 'responsive' => 1,
544
+ 'priority' => 1
545
+ ), true);
546
+
547
+ // cross-sells disable
548
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_cross_sells]', array(
549
+ 'type' => 'option',
550
+ 'capability' => 'edit_theme_options',
551
+ 'transport' => 'refresh',
552
+ ),
553
+ );
554
 
555
+ $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_cross_sells]', array(
556
+ 'type' => 'checkbox',
557
+ 'label' => __('Disable Cross-sells'),
558
+ 'section' => 'pgl_woo_cart_page',
559
+ 'priority' => 2
560
+ ))
561
+ );
562
 
563
+ // Checkout Page Section
564
+ $wp_customize->add_section( 'pgl_woo_checkout', array(
565
+ 'panel' => 'pgl_woocommerce',
566
+ 'title' => __('Checkout'),
567
+ 'priority' => 9,
 
568
  )
569
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
 
571
+ // Checkout page settings
572
+ pagelayer_register_padding_customizer_control($wp_customize, array(
573
+ 'control' => 'pagelayer_customizer_options',
574
+ 'control_array_sufix' => 'woo_checkout_padding',
575
+ 'section' => 'pgl_woo_checkout',
576
+ 'label' => __( 'Padding', 'pagelayer' ),
577
  'capability' => 'edit_theme_options',
578
+ 'setting_type' => 'option',
579
  'transport' => 'refresh',
580
+ 'default' => '',
581
+ 'units' => ['px', 'em', '%'],
582
+ 'responsive' => 1,
583
+ 'priority' => 1
584
+ ), true);
585
+
586
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_order_note]', array(
587
+ 'type' => 'option',
588
+ 'capability' => 'edit_theme_options',
589
+ 'transport' => 'refresh',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  ),
591
+ );
592
 
593
+ $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_order_note]', array(
594
+ 'type' => 'checkbox',
595
+ 'label' => __('Disable Order Note'),
596
+ 'section' => 'pgl_woo_checkout',
597
+ 'priority' => 2
598
+ ))
599
+ );
600
 
601
+ $wp_customize->add_setting( 'pagelayer_customizer_options[woo_disable_coupon_field]', array(
602
+ 'type' => 'option',
603
+ 'capability' => 'edit_theme_options',
604
+ 'transport' => 'refresh',
605
+ ),
606
+ );
 
 
 
607
 
608
+ $wp_customize->add_control( new Pagelayer_Custom_Control( $wp_customize, 'pagelayer_customizer_options[woo_disable_coupon_field]', array(
609
+ 'type' => 'checkbox',
610
+ 'label' => __('Disable Coupon Field'),
611
+ 'section' => 'pgl_woo_checkout',
612
+ 'priority' => 3
613
+ ))
614
+ );
615
 
616
+ // My Account Page Section
617
+ $wp_customize->add_section( 'pgl_woo_myaccount_page', array(
618
+ 'panel' => 'pgl_woocommerce',
619
+ 'title' => __('My Account'),
620
+ 'priority' => 10,
 
 
621
  )
622
+ );
623
 
624
+ // My Account page settings
625
+ pagelayer_register_padding_customizer_control($wp_customize, array(
626
+ 'control' => 'pagelayer_customizer_options',
627
+ 'control_array_sufix' => 'woo_myaccount_padding',
628
+ 'section' => 'pgl_woo_myaccount_page',
629
+ 'label' => __( 'Padding', 'pagelayer' ),
630
  'capability' => 'edit_theme_options',
631
+ 'setting_type' => 'option',
632
  'transport' => 'refresh',
633
+ 'default' => '',
634
+ 'units' => ['px', 'em', '%'],
635
+ 'responsive' => 1,
636
+ 'priority' => 1
637
+ ), true);
638
+ }
639
+
640
+ if(defined('PAGELAYER_PREMIUM')){
641
+ include_once(dirname(__FILE__).'/premium-woocommerce.php');
 
 
 
 
 
642
  }
pagelayer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
- Version: 1.7.0
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
+ Version: 1.7.1
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: page builder, editor, drag and drop, form builder, landing page, responsiv
4
  Requires at least: 4.7
5
  Tested up to: 6.0
6
  Requires PHP: 5.5
7
- Stable tag: 1.7.0
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
@@ -127,6 +127,9 @@ Do you have questions related to Pagelayer? Use the following links :
127
 
128
  == Changelog ==
129
 
 
 
 
130
  = 1.7.0 (July 28, 2022) =
131
  * [Task] The typography properties has been further improved.
132
  * [Task] Added global color option for the gradient property.
4
  Requires at least: 4.7
5
  Tested up to: 6.0
6
  Requires PHP: 5.5
7
+ Stable tag: 1.7.1
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
127
 
128
  == Changelog ==
129
 
130
+ = 1.7.1 (Sep 07, 2022) =
131
+ * [Feature] Added Customizer settings for WooCommerce. Now you can easily customize your WooCommerce Store.
132
+
133
  = 1.7.0 (July 28, 2022) =
134
  * [Task] The typography properties has been further improved.
135
  * [Task] Added global color option for the gradient property.