Differenze tra le versioni di "WordPress:Sezione di una pagina di amministrazione"
Riga 4: | Riga 4: | ||
[[File: sdvsbdrvuydvbuiy5g.png|frame|center]] | [[File: sdvsbdrvuydvbuiy5g.png|frame|center]] | ||
+ | |||
+ | <pre> | ||
+ | add_action( 'admin_init', 'my_settings_init' ); | ||
+ | |||
+ | function my_settings_init() { | ||
+ | add_settings_section( | ||
+ | 'sample_page_setting_section', | ||
+ | __( 'Custom settings', 'my-textdomain' ), | ||
+ | 'my_setting_section_callback_function', | ||
+ | 'sample-page' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | function my_setting_section_callback_function() { | ||
+ | echo '<p>Intro text for our settings section</p>'; | ||
+ | } | ||
+ | </pre> |
Versione delle 20:29, 5 set 2021
add_action( 'admin_init', 'my_settings_init' ); function my_settings_init() { add_settings_section( 'sample_page_setting_section', __( 'Custom settings', 'my-textdomain' ), 'my_setting_section_callback_function', 'sample-page' ); } function my_setting_section_callback_function() { echo '<p>Intro text for our settings section</p>'; }