Plugin Directory

Changeset 3399261


Ignore:
Timestamp:
11/19/2025 07:53:16 PM (4 months ago)
Author:
webbuilder143
Message:

1.6.0

  • [Add] New option to disable WooCommerce default tabs.
  • Tested with: WooCommerce 10.3.5
Location:
wb-custom-product-tabs-for-woocommerce
Files:
46 added
7 edited

Legend:

Unmodified
Added
Removed
  • wb-custom-product-tabs-for-woocommerce/trunk/admin/class-wb-custom-product-tabs-for-woocommerce-admin.php

    r3381997 r3399261  
    990990            )
    991991        );
     992
     993        /**
     994         *  Register settings to disable WooCommerce default tabs.
     995         *
     996         *  @since 1.6.0
     997         */
     998        register_setting(
     999            'wb_cptb_custom_tab_settings_group',
     1000            'wb_cptb_enable_default_tabs',
     1001            array(
     1002                'type' => 'array',
     1003                'sanitize_callback' => array( $this, 'sanitize_default_tab_status' ),
     1004                'default' => array('description', 'additional_information', 'reviews'),
     1005            )
     1006        );
    9921007    }
    9931008
     
    14031418        return $postmeta;
    14041419    }
     1420
     1421    /**
     1422     * Sanitize WooCommerce default tab status option.
     1423     *
     1424     * @since 1.6.0
     1425     * @param mixed $value Array of selected tab slugs.
     1426     * @return string[] Sanitized tab slugs.
     1427     */
     1428    public function sanitize_default_tab_status( $value ) {
     1429
     1430        $allowed = array( 'description', 'additional_information', 'reviews' );
     1431
     1432        // Ensure it's an array
     1433        if ( ! is_array( $value ) ) {
     1434            return array();
     1435        }
     1436
     1437        // Sanitize each value
     1438        $sanitized = array();
     1439        foreach ( $value as $item ) {
     1440            $item = sanitize_text_field( $item );
     1441            if ( in_array( $item, $allowed, true ) ) {
     1442                $sanitized[] = $item;
     1443            }
     1444        }
     1445
     1446        return $sanitized;
     1447    }
    14051448}
  • wb-custom-product-tabs-for-woocommerce/trunk/admin/views/-general-settings.php

    r3381997 r3399261  
    5858
    5959            <tr valign="top">
     60                <th scope="row"><?php esc_html_e( 'Enable default tabs', 'wb-custom-product-tabs-for-woocommerce' ); ?></th>
     61
     62                <td>
     63                    <?php
     64                    $default_tabs_status = Wb_Custom_Product_Tabs_For_Woocommerce::get_default_woo_tab_status();
     65                    ?>
     66
     67                    <label style="display:block; margin-bottom:6px;">
     68                        <input type="checkbox" name="wb_cptb_enable_default_tabs[]" value="description"
     69                            <?php checked( in_array( 'description', $default_tabs_status, true ) ); ?> />
     70                        <?php esc_html_e( 'Description', 'wb-custom-product-tabs-for-woocommerce' ); ?>
     71                    </label>
     72
     73                    <label style="display:block; margin-bottom:6px;">
     74                        <input type="checkbox" name="wb_cptb_enable_default_tabs[]" value="additional_information"
     75                            <?php checked( in_array( 'additional_information', $default_tabs_status, true ) ); ?> />
     76                        <?php esc_html_e( 'Additional Information', 'wb-custom-product-tabs-for-woocommerce' ); ?>
     77                    </label>
     78
     79                    <label style="display:block; margin-bottom:6px;">
     80                        <input type="checkbox" name="wb_cptb_enable_default_tabs[]" value="reviews"
     81                            <?php checked( in_array( 'reviews', $default_tabs_status, true ) ); ?> />
     82                        <?php esc_html_e( 'Reviews', 'wb-custom-product-tabs-for-woocommerce' ); ?>
     83                    </label>
     84                </td>
     85            </tr>
     86
     87
     88            <tr valign="top">
    6089                <th scope="row"><?php esc_html_e( 'Default Behavior of Global Tabs', 'wb-custom-product-tabs-for-woocommerce' ); ?></th>
    6190                <td>
  • wb-custom-product-tabs-for-woocommerce/trunk/admin/views/-help.php

    r3381997 r3399261  
    245245        </div>
    246246
    247 
    248247        <!-- Question: 6 -->
    249248        <div class="wb-cptb-accordion-item">
     
    262261                    <?php esc_html_e( 'Before importing the tabs, you must first import Products, Categories, Tags, and Brands. This ensures that all tab assignments are mapped correctly to the corresponding items.', 'wb-custom-product-tabs-for-woocommerce' ); ?>
    263262                </p>
     263            </div>
     264        </div>
     265
     266        <!-- Question: 7 -->
     267        <div class="wb-cptb-accordion-item">
     268            <button class="wb-cptb-accordion-button">
     269                <?php esc_html_e( 'Can I disable WooCommerce default tabs?', 'wb-custom-product-tabs-for-woocommerce' ); ?>
     270            </button>
     271            <div class="wb-cptb-accordion-content">
     272                <p><?php esc_html_e( 'Yes. The plugin allows you to control which default WooCommerce tabs appear on product pages. You can enable or disable the Description, Additional Information, and Reviews tabs directly from the plugin settings.', 'wb-custom-product-tabs-for-woocommerce' ); ?></p>
    264273            </div>
    265274        </div>
  • wb-custom-product-tabs-for-woocommerce/trunk/includes/class-wb-custom-product-tabs-for-woocommerce.php

    r3381997 r3399261  
    7070            $this->version = WB_CUSTOM_PRODUCT_TABS_FOR_WOOCOMMERCE_VERSION;
    7171        } else {
    72             $this->version = '1.5.3';
     72            $this->version = '1.6.0';
    7373        }
    7474        $this->plugin_name = 'wb-custom-product-tabs-for-woocommerce';
     
    320320         */
    321321        $this->loader->add_action( 'wp_footer', $plugin_public, 'activate_tab_by_url' );
     322
     323
     324        /**
     325         * Hide the default WooCommerce tabs based on plugin settings.
     326         *
     327         * @since 1.6.0
     328         */
     329        $this->loader->add_filter( 'woocommerce_product_tabs', $plugin_public, 'toggle_default_tabs', 20 );
    322330    }
    323331
     
    967975        return $taxonomies;
    968976    }
     977
     978    /**
     979     *  Get WooCommerce default tab status.
     980     *
     981     *  @since 1.6.0
     982     *  @return string[] Slugs of enabled WooCommerce default tabs.
     983     */
     984    public static function get_default_woo_tab_status() {
     985        return get_option(
     986            'wb_cptb_enable_default_tabs',
     987            array( 'description', 'additional_information', 'reviews' )
     988        );
     989    }
    969990}
  • wb-custom-product-tabs-for-woocommerce/trunk/public/class-wb-custom-product-tabs-for-woocommerce-public.php

    r3352137 r3399261  
    287287    }
    288288
     289    /**
     290     * Hide the default WooCommerce tabs based on plugin settings.
     291     *
     292     * @since 1.6.0
     293     * @param array $tabs Array of WooCommerce tabs.
     294     * @return array Modified tabs.
     295     */
     296    public function toggle_default_tabs( $tabs ) {
     297
     298        $default_tabs_status = Wb_Custom_Product_Tabs_For_Woocommerce::get_default_woo_tab_status();
     299
     300        $supported_tabs = array(
     301            'description',
     302            'additional_information',
     303            'reviews',
     304        );
     305
     306        if ( is_array( $tabs ) && is_array( $default_tabs_status ) ) {
     307
     308            foreach ( $supported_tabs as $key ) {
     309
     310                if ( isset( $tabs[ $key ] ) && ! in_array( $key, $default_tabs_status, true ) ) {
     311                    unset( $tabs[ $key ] );
     312                }
     313
     314            }
     315        }
     316
     317        return $tabs;
     318    }
    289319}
  • wb-custom-product-tabs-for-woocommerce/trunk/readme.txt

    r3381997 r3399261  
    22Contributors: webbuilder143
    33Donate link: https://webbuilder143.com/?utm_source=wordpressorg&utm_medium=readme&utm_campaign=donate-link&utm_id=tabs-plugin&utm_content=donate
    4 Tags: product tabs, tab manager, woocommerce custom tabs, woocommerce product tabs, tabs plugin
     4Tags: product tabs, tabs plugin, woocommerce custom tabs, woocommerce product tabs, tabs
    55Requires at least: 3.5.0
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 1.5.3
     8Stable tag: 1.6.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Add unlimited additional tabs to WooCommerce products and assign them by category, tag, brand, or product. Supports sorting, shortcode etc. 
     12Create unlimited WooCommerce tabs and assign them in bulk by category, tag, brand, or product. Also disable WooCommerce’s default product tabs.
    1313
    1414== Description ==
     
    2525✅ Unlimited Custom Tabs – Add as many custom tabs as needed for your WooCommerce products.
    2626✅ Global Tabs – Create tabs that can be assigned to multiple products based on categories, tags, and WooCommerce brands.
     27✅ Category specific Tabs.
     28✅ Option to disable WooCommerce default product tabs such as the Description, Additional Information, and Reviews tabs.
     29✅ Product specific Tabs.
     30✅ Supports the default WordPress Exporter and the WordPress Importer plugin to migrate the tabs.
    2731✅ Brand-Specific Tabs – Fully supports WooCommerce's default brand functionality and third-party brand plugins like [Perfect Brands for WooCommerce](https://wordpress.org/plugins/perfect-woocommerce-brands/).
    2832✅ YouTube Embed Support – Easily embed YouTube videos directly within product tabs.
     
    97101To add tabs to a product, navigate to the product edit screen in WooCommerce. In the left corner of the Product Data box, you will find the "Custom Tabs" option.
    98102
     103= Can I disable WooCommerce default tabs? =
     104Absolutely. The plugin allows you to control which default WooCommerce tabs appear on product pages. You can enable or disable the Description, Additional Information, and Reviews tabs directly from the plugin settings.
     105
    99106= Can I add HTML content? =
    100107Yes, you can add HTML content. The tab content section uses the standard WP editor, allowing you to include any HTML content supported by the WordPress post editor.
     
    155162
    156163== Changelog ==
     164
     165= 1.6.0 =
     166* [Add] New option to disable WooCommerce default tabs.
     167* Tested with: WooCommerce 10.3.5
    157168
    158169= 1.5.3 =
     
    352363== Upgrade Notice ==
    353364
    354 = 1.5.3 =
    355 * [Improvement] Added compatibility with the WordPress Export tool and the WordPress Importer plugin by @wordpressdotorg.
    356 * Tested with: WooCommerce 10.2.2
     365= 1.6.0 =
     366* [Add] New option to disable WooCommerce default tabs.
     367* Tested with: WooCommerce 10.3.5
  • wb-custom-product-tabs-for-woocommerce/trunk/wb-custom-product-tabs-for-woocommerce.php

    r3381997 r3399261  
    1212 * Plugin URI:              https://wordpress.org/plugins/wb-custom-product-tab-for-wooCommerce/
    1313 * Description:             Create your own product tabs and assign it to your WooCommerce products
    14  * Version:                 1.5.3
     14 * Version:                 1.6.0
    1515 * WC requires at least:    5.0.0
    16  * WC tested up to:         10.2
     16 * WC tested up to:         10.3
    1717 * Author:                  Web Builder 143
    1818 * Author URI:              https://profiles.wordpress.org/webbuilder143/
     
    3030/**
    3131 * Currently plugin version.
    32  * Start at version 1.0.0 and use SemVer - https://semver.org
    33  * Rename this for your plugin and update it as you release new versions.
    3432 */
    35 define( 'WB_CUSTOM_PRODUCT_TABS_FOR_WOOCOMMERCE_VERSION', '1.5.3' );
     33define( 'WB_CUSTOM_PRODUCT_TABS_FOR_WOOCOMMERCE_VERSION', '1.6.0' );
    3634define( 'WB_TAB_PLUGIN_FILENAME', __FILE__ );
    3735define( 'WB_TAB_ROOT_PATH', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.