-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwp-modern-settings-page-boilerplate.php
46 lines (39 loc) · 1.41 KB
/
wp-modern-settings-page-boilerplate.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
37
38
39
40
41
42
43
44
45
<?php
/**
* Plugin Name: Modern Settings Page Boilerplate for WordPress
* Plugin URI: https://github.com/fnpen/wp-modern-settings-page-boilerplate
* Description: Example plugin of using Gutenberg components for creating your own settings page.
*
* Text Domain: wp-modern-settings-page-boilerplate
* Domain Path: /languages
*
* Author: Ilya Zolotov
* Author URI: https://ilyazolotov.com/
*
* Version: 0.0.1
* Requires at least: 5.8
* Tested up to: 6.1.1
* Requires PHP: 7.1
*/
namespace ModernSettingsPageBoilerplate;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'MODERN_SETTINGS_PATH', \plugin_dir_path( __FILE__ ) );
define( 'MODERN_SETTINGS_URL', \plugins_url( '/', __FILE__ ) );
define( 'MODERN_SETTINGS_PLUGIN_FILE', __FILE__ );
define( 'MODERN_SETTINGS_PLUGIN_DIR', __DIR__ );
define( 'MODERN_SETTINGS_VERSION', '0.0.1' );
require 'includes/utils/register-ajax-method.php';
require 'includes/utils/enqueue-scripts-from-asset-file.php';
require 'includes/admin-page.php';
require 'includes/ajax.php';
add_filter(
'modern_settings_variables',
function( $variables ) {
$variables['notice_hidden'] = get_option( 'modern-settings/notice_hidden', false );
$variables['simple_form'] = get_option( 'modern-settings/simple_form', [] );
$variables['repeated_form'] = get_option( 'modern-settings/repeated_form', [] );
return $variables;
}
);