-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-settings.php
36 lines (30 loc) · 1.04 KB
/
admin-settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
if (!defined('ABSPATH')) {
throw new RuntimeException("WordPress environment not loaded. Exiting...");
}
if (!checkUserPermissions()) {
return;
}
if (isset($_POST['modal_title'], $_POST['modal_content'])) {
update_option('modal_title', $_POST['modal_title']);
update_option('modal_content', $_POST['modal_content']);
}
// Fetch data
$modal_title = get_option('modal_title') ?? '';
$modal_content = get_option('modal_content' ?? '');
?>
<div class="wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<form method="post">
<label for="modal_title">Modal Title</label>
<input type="text" id="modal_title" name="modal_title" value="<?php echo $modal_title; ?>">
<label for="modal_content">Modal Content</label>
<?php
$content = stripslashes($modal_content);
$editor_id = 'modal_content';
wp_editor($content, $editor_id);
?>
<input type="submit" value="Save Changes">
</form>
</div>
<?php