Created
April 9, 2020 11:37
-
-
Save mohnatus/fe796f4ffbdb283726a1b568e27a3db7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('admin_init', 'add_options_section'); | |
| function add_options_section() { | |
| add_settins_section( | |
| 'section_name', | |
| 'Section Title', | |
| 'section_callback', | |
| 'reading' | |
| ); | |
| add_settings_field( | |
| 'field_name', | |
| 'Field Label', | |
| 'field_callback', | |
| 'reading', | |
| 'section_name' | |
| ); | |
| register_setting('reading', 'option_name', 'strip_tags'); | |
| } | |
| function section_callback() { | |
| echo 'Some message before options fields'; | |
| } | |
| function field_callback() { | |
| $option = get_option('option_name'); | |
| ?> | |
| <input name='option_name' value='<?= $option ?>'> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment