-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin-acf.php
60 lines (52 loc) · 1.23 KB
/
admin-acf.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
defined('ABSPATH') || exit;
class My_Plugin_Settings {
/**
* Initialize class.
*
* @access public
* @since 1.0.0
* @return void
*/
public function __construct() {
add_action('acf/init', [$this, 'settings']);
}
/**
* Adds ACF options page and fields.
*
* @access public
* @since 1.0.0
* @return void
*/
public function settings() {
acf_add_options_page([
'page_title' => 'Plugin Name',
'menu_title' => 'Plugin Name',
'menu_slug' => 'plugin-settings-slug',
'parent_slug' => 'options-general.php',
'update_button' => 'Save',
'updated_message' => 'Settings Saved.',
'capability' => 'edit_posts',
'redirect' => false,
]);
acf_add_local_field_group([
'key' => 'group_vtl_settings',
'title' => 'Plugin Name Settings',
'fields' => [],
'location' => [
[
[
'param' => 'options_page',
'operator' => '==',
'value' => 'plugin-settings-slug',
],
],
],
'style' => 'seamless',
'label_placement' => 'top',
'instruction_placement' => 'label',
'active' => 1,
]);
}
}
new My_Plugin_Settings();