Functions to Add Settings to a WooCommerce Settings Tab
<?php | |
add_action( 'woocommerce_settings_tabs_settings_tab_demo', 'settings_tab' ); | |
function settings_tab() { | |
woocommerce_admin_fields( get_settings() ); | |
} | |
function get_settings() { | |
$settings = array( | |
'section_title' => array( | |
'name' => __( 'Section Title', 'woocommerce-settings-tab-demo' ), | |
'type' => 'title', | |
'desc' => '', | |
'id' => 'wc_settings_tab_demo_section_title' | |
), | |
'title' => array( | |
'name' => __( 'Title', 'woocommerce-settings-tab-demo' ), | |
'type' => 'text', | |
'desc' => __( 'This is some helper text', 'woocommerce-settings-tab-demo' ), | |
'id' => 'wc_settings_tab_demo_title' | |
), | |
'description' => array( | |
'name' => __( 'Description', 'woocommerce-settings-tab-demo' ), | |
'type' => 'textarea', | |
'desc' => __( 'This is a paragraph describing the setting. Lorem ipsum yadda yadda yadda. Lorem ipsum yadda yadda yadda. Lorem ipsum yadda yadda yadda. Lorem ipsum yadda yadda yadda.', 'woocommerce-settings-tab-demo' ), | |
'id' => 'wc_settings_tab_demo_description' | |
), | |
'section_end' => array( | |
'type' => 'sectionend', | |
'id' => 'wc_settings_tab_demo_section_end' | |
) | |
); | |
return apply_filters( 'wc_settings_tab_demo_settings', $settings ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment