Information Technology Reference
In-Depth Information
15
This section creates the FollowMe Settings page. This function looks like Figure 15.5 when it is
displayed.
Figure 15.5
Create this
complete
settings
page with a
dozen lines
of code.
Add the Follow Me Settings page to the main WordPress Settings area by adding this simple func-
tion,
add_submenu_page
:
function _menu() {
add_submenu_page('options-general.php',
'followme: FollowMe Settings',
'FollowMe Settings', 8,
__FILE__,
array('followme', 'menu')
);
}
function menu() {
// sanitize referrer
$_SERVER['HTTP_REFERER'] = preg_replace(
'~&saved=.*$~Uis','', $_SERVER['HTTP_REFERER']
);
// information updated ?
When you have a Settings page, don't forget to include a way to save the changes:
if ($_POST['submit']) {
$_ = $_POST['followme_settings'];
$_['snippets'] = array_map('stripCSlashes', $_['snippets']);
![](WordPress-in-Depth_images/img-gen1413.png)
![](WordPress-in-Depth_images/img-gen1414.png)