Plugin Directory

Changeset 3309805


Ignore:
Timestamp:
06/11/2025 12:41:33 PM (10 months ago)
Author:
doubledome
Message:

Release Note: Version 2.1
A minor update introducing the option to easily remove banner blocks from the category banner settings.

Location:
category-banner-management-for-woocommerce
Files:
10 added
3 edited

Legend:

Unmodified
Added
Removed
  • category-banner-management-for-woocommerce/trunk/admin/settings.php

    r3302529 r3309805  
    3838                            <input type="date" class="widefat" name="cbmfwc_banner_groups[<?php echo $index; ?>][end_date]" value="<?php echo esc_attr($group['end_date'] ?? ''); ?>" />
    3939                        </label></p>
     40                        <p><button class="button cbmfwc-remove-banner" type="button" style="margin-top:10px; background-color: #d63638; color: #fff;">Remove Banner</button>
     41</p>
    4042                        <hr>
    4143                    </div>
     
    7476                        <input type="date" class="widefat" name="cbmfwc_banner_groups[` + groupIndex + `][end_date]" />
    7577                    </label></p>
     78                    <p><button class="button cbmfwc-remove-banner" type="button" style="margin-top:10px; background-color: #d63638; color: #fff;">Remove Banner</button>
     79</p>
    7680                    <hr>
    7781                </div>`;
     
    99103            frame.open();
    100104        });
     105
     106         $(document).on('click', '.cbmfwc-remove-banner', function(e) {
     107            e.preventDefault();
     108            $(this).closest('.cbmfwc-banner-group').remove();
     109        });
    101110    });
    102111    </script>
     
    117126        $sanitized = [];
    118127        foreach ($_POST['cbmfwc_banner_groups'] as $group) {
    119             $sanitized[] = [
    120                 'desktop'    => esc_url_raw($group['desktop']),
    121                 'tablet'     => esc_url_raw($group['tablet']),
    122                 'mobile'     => esc_url_raw($group['mobile']),
    123                 'link'       => esc_url_raw($group['link']),
    124                 'link_new_tab' => sanitize_text_field($group['link_new_tab']),
    125                 'start_date' => sanitize_text_field($group['start_date']),
    126                 'end_date'   => sanitize_text_field($group['end_date']),
    127             ];
     128            if (!empty($group['desktop']) || !empty($group['tablet']) || !empty($group['mobile'])) {
     129                $sanitized[] = [
     130                    'desktop'    => esc_url_raw($group['desktop']),
     131                    'tablet'     => esc_url_raw($group['tablet']),
     132                    'mobile'     => esc_url_raw($group['mobile']),
     133                    'link'       => esc_url_raw($group['link']),
     134                    'link_new_tab' => sanitize_text_field($group['link_new_tab']),
     135                    'start_date' => sanitize_text_field($group['start_date']),
     136                    'end_date'   => sanitize_text_field($group['end_date']),
     137                ];
     138            }
    128139        }
    129140        update_term_meta($term_id, 'cbmfwc_banner_groups', $sanitized);
  • category-banner-management-for-woocommerce/trunk/category-banner-management-for-woocommerce.php

    r3302529 r3309805  
    66 * Author:      DoubleDome Digital Marketing
    77 * Author URI:  https://www.doubledome.com/category-banner-management-for-woocommerce
    8  * Version:     2.0
     8 * Version:     2.1
    99 * License:     GPL-2.0+
    1010 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    1717define( 'CBMFWC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    1818define( 'CBMFWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    19 define( 'CBMFWC_VERSION', '2.0' );
     19define( 'CBMFWC_VERSION', '2.1' );
    2020
    2121// Include admin settings
     
    2626function cbmfwc_load_assets() {
    2727    if ( is_product_category() ) {
    28         wp_enqueue_script( 'cbmfwc-frontend', CBMFWC_PLUGIN_URL . 'assets/js/frontend.js', array('jquery'), '2.0', true );
     28        wp_enqueue_script( 'cbmfwc-frontend', CBMFWC_PLUGIN_URL . 'assets/js/frontend.js', array('jquery'), '2.1', true );
    2929        wp_enqueue_style( 'cbmfwc-frontend', CBMFWC_PLUGIN_URL . 'assets/css/admin.css' );
    3030        wp_enqueue_style('swiper', 'https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css', array(), '11');
  • category-banner-management-for-woocommerce/trunk/readme.txt

    r3302530 r3309805  
    44Requires at least: 4.0
    55Tested up to: 6.8.1
    6 Stable tag: 2.0
     6Stable tag: 2.1
    77License: GPL-2.0+
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5151== Changelog ==
    5252
     53= 2.1 =
     54* Added Delete Banner block option.
     55
    5356= 2.0 =
    5457* Major rewrite and upgrade of the plugin system.
Note: See TracChangeset for help on using the changeset viewer.