plugin_name = $plugin_name; $this->active_tab = (isset($_GET['tab'])) ? sanitize_text_field($_GET['tab']) : 'default'; if($this->this_tab == $this->active_tab){ add_action($this->plugin_name.'_tab_content', array($this,'tab_content')); } add_action($this->plugin_name.'_tab', array($this,'tab'),1); $this->settings = array( array('field'=>'sunday', 'class'=> 'bg-secondary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Add to Cart button','pisol-dtt'), 'type'=>'setting_category'), array('field'=>'pi_dcw_change_add_to_cart','desc'=>'Do you want to change the button text of add to cart button', 'label'=>__('Change Add to cart button text','pi-dcw'),'type'=>'switch', 'default'=>0), array('field'=>'pi_dcw_add_to_cart_text','desc'=>'This text will be shown inside add to cart button', 'label'=>__('Add to cart button text','pi-dcw'),'type'=>'text', 'default'=>__('Add to cart', 'woocommerce')), ); $this->register_settings(); /** * change add to cart text in single product page */ add_filter('woocommerce_product_single_add_to_cart_text', array($this, 'add_product_text'), 10, 2); /** * change add to cart text in product loop */ add_filter('woocommerce_product_add_to_cart_text', array($this, 'add_product_text'), 10, 2); } function register_settings(){ foreach($this->settings as $setting){ register_setting( $this->setting_key, $setting['field']); } } function tab(){ ?> tab_name, 'http2-push-content' ); ?>
plugin_name);