Last active
December 30, 2015 11:09
-
-
Save ahmad24/7820815 to your computer and use it in GitHub Desktop.
wordpress : Add section to existing page
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 | |
// Register and define the settings | |
add_action('admin_init', 'boj_myplugin_admin_init'); | |
function boj_myplugin_admin_init(){ | |
//You still need to whitelist this setting, with register_setting() . | |
//Omitting this step would make WordPress ignore the setting when submitting the form. | |
register_setting( | |
'privacy', | |
'boj_myplugin_options', | |
'boj_myplugin_validate_options' | |
); | |
add_settings_section( | |
'boj_myplugin_options', | |
'My Plugin Settings', | |
'boj_myplugin_section_text', | |
'privacy' | |
); | |
add_settings_field( | |
'boj_myplugin_text_string', | |
'Enter text here', | |
'boj_myplugin_setting_input', | |
'privacy', | |
'boj_myplugin_options' | |
); | |
} | |
/** | |
* register field plugin | |
*/ | |
/*function boj_myplugin_admin_init(){ | |
register_setting( | |
'privacy', | |
'boj_myplugin_options', | |
'boj_myplugin_validate_options' | |
); | |
add_settings_field( | |
'boj_myplugin_text_string', | |
'Enter text here', | |
'boj_myplugin_setting_input', | |
'privacy', | |
'default' | |
); | |
}*/ | |
?> |
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 | |
// Register and define the settings | |
add_action('admin_init', 'boj_myplugin_admin_init'); | |
function boj_myplugin_admin_init(){ | |
//You still need to whitelist this setting, with register_setting() . | |
//Omitting this step would make WordPress ignore the setting when submitting the form. | |
register_setting( | |
'privacy', | |
'boj_myplugin_options', | |
'boj_myplugin_validate_options' | |
); | |
add_settings_section( | |
'boj_myplugin_options', | |
'My Plugin Settings', | |
'boj_myplugin_section_text', | |
'privacy' | |
); | |
add_settings_field( | |
'boj_myplugin_text_string', | |
'Enter text here', | |
'boj_myplugin_setting_input', | |
'privacy', | |
'boj_myplugin_options' | |
); | |
} | |
/** | |
* register field plugin | |
*/ | |
/*function boj_myplugin_admin_init(){ | |
register_setting( | |
'privacy', | |
'boj_myplugin_options', | |
'boj_myplugin_validate_options' | |
); | |
add_settings_field( | |
'boj_myplugin_text_string', | |
'Enter text here', | |
'boj_myplugin_setting_input', | |
'privacy', | |
'default' | |
); | |
}*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment