0
我正在開發一個插件庫插件。所以我創建了一個自定義的帖子類型,在它下面我創建了一個子菜單頁面,用於在更新值時更改圖庫選項,例如邊框寬度,邊框顏色,邊框半徑等,所有工作都正常,但不會顯示更新通知。 我在這裏編寫主代碼。請讓我知道什麼是問題。更新通知未顯示
function gallery_setting_pages() {
add_submenu_page(
'edit.php?post_type=gallary',
'Gallery Settings',
'Settings',
'manage_options',
'gallery-setting',
'gallery_option_page_functions'
);
}
add_action('admin_menu','gallery_setting_pages');
if (is_admin()) :
function ppmscrollbar_register_settings() {
register_setting('gallery_plugin_options','rt_gallery_options','rt_gallery_validate_options');
}
add_action('admin_init','ppmscrollbar_register_settings');
function gallery_option_page_functions() {
global $rt_gallery_options;
if (! isset ($_REQUEST['updated']))
$_REQUEST['updated']=false;
?>
<?php if (false !==$_REQUEST['updated']) : ?>
<div class="updated fade"><p><strong><?php _e('options saved'); ?></strong></p></div>
<?php endif; // If the form has just been submitted, this show the notification ?>
<form method="post" action="options.php">
<?php $settings=get_option('rt_gallery_options', $rt_gallery_options); ?>
<?php settings_fields('gallery_plugin_options'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="cursor_color">Select Gallery Border Color</label></th>
<td>
<input id="cursor_color" type="text" name="rt_gallery_options[cursor_color]" value="<?php echo stripslashes($settings['cursor_color']); ?>" class="my-color-field" /><p class="description">In a few words, explain what is this.</p>
</td>
</tr>
</table>
<p class="submit"><input type="submit" value="Save Changes" class="button button-primary" id="submit" name="submit"></p>
</form>
</div>
<?php
}
function rt_gallery_validate_options($input){
global $rt_gallery_options;
$settings = get_option('rt_gallery_options', $rt_gallery_options);
//We strip all tags from the text field, to avoid vulnerablilties like XSS
$input['cursor_color']=wp_filter_post_kses($input['cursor_color']);
return $input;
}
endif; //EndIf is_admin()