by
54 7
0
7
238k
4
Top 1% !
Popular
Pearl of Wisdom
Tagged
Specified
Refined
Debate
Popularity: 5951st place
This snippet is Public
ClassNameWoo_Settings
Languagehandlebars
Languagehtml+php
LicenseMIT_X11
MethodNameinit
OutputTypefunction

add WooCommerce settins tab

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/310789/add-WooCommerce-settins-tab?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<?php if ( !class_exists('Woo_Settings ') ): /** * * @version 1.0 * @access public */ class Woo_Settings { public static function init() { add_filter( 'woocommerce_settings_tabs_array', __CLASS__ . '::add_settings_tab', 70); add_action( 'woocommerce_settings_tabs_settings_orders_page', __CLASS__ . '::settings_tab' ); } /** * Add a new settings tab to the WooCommerce settings tabs array. */ public static function add_settings_tab( $settings_tabs ) { $settings_tabs['settings_orders_page'] = __( 'Orders Page', 'linen' ); return $settings_tabs; } /** * Uses the WooCommerce admin fields API to output settings via the @see woocommerce_admin_fields() function. * * @uses woocommerce_admin_fields() * @uses self::get_settings() */ public static function settings_tab() { woocommerce_admin_fields( self::get_settings() ); } /** * Get all the settings for this plugin for @see woocommerce_admin_fields() function. * * @return array Array of settings for @see woocommerce_admin_fields() function. */ public static function get_settings() { $settings[] = array( 'title' => __( 'Orders Page', 'linen' ), 'type' => 'title', 'desc' => '', 'id' => 'wc_order_customiser_orders_page' ); $settings[] = array( 'title' => __( 'Table Type', 'linen' ), 'id' => 'wc_order_customiser_table_type', 'default' => 'static', 'type' => 'radio', 'options' => array( 'static' => __( 'Static', 'linen' ), 'dynamic' => __( 'Dynamic', 'linen' ), ), 'autoload' => true ); $settings[] = array( 'type' => 'sectionend', 'id' => 'wc_order_customiser_orders_page' ); $settings[] = array( 'title' => __( 'Position & Size', 'linen' ), 'type' => 'title', 'desc' => '', 'id' => 'wc_order_customiser_position_n_size' ); $settings[] = array( 'title' => __( 'Table Type', 'linen' ), 'id' => 'wc_order_customiser_table_type', 'default' => 'static', 'type' => 'radio', 'options' => array( 'static' => __( 'Static', 'linen' ), 'dynamic' => __( 'Dynamic', 'linen' ), ), 'autoload' => true ); $settings[] = array( 'type' => 'sectionend', 'id' => 'wc_order_customiser_position_n_size' ); return apply_filters( 'wc_settings_tab_orders_page', $settings ); } /** * Uses the WooCommerce options API to save settings via the @see woocommerce_update_options() function. * * @uses woocommerce_update_options() * @uses self::get_settings() */ public static function update_settings() { woocommerce_update_options( self::get_settings() ); } } Woo_Settings::init(); endif; ?>
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus