@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @param WP_Fields_API $wp_fields |
6 | 6 | */ |
7 | -function example_my_term_starter( $wp_fields ) { |
|
7 | +function example_my_term_starter($wp_fields) { |
|
8 | 8 | |
9 | 9 | // Object type: Term |
10 | 10 | $object_type = 'term'; |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | $section_id = ''; // @todo Fill in section ID |
23 | 23 | |
24 | - $wp_fields->add_section( $object_type, $section_id, $object_name, array( |
|
25 | - 'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain |
|
24 | + $wp_fields->add_section($object_type, $section_id, $object_name, array( |
|
25 | + 'title' => __('', 'my-text-domain'), // @todo Fill in section heading, update text domain |
|
26 | 26 | 'screen' => $screen_id, |
27 | - ) ); |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | // My Field |
30 | 30 | $field_id = ''; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | 'control' => array( |
33 | 33 | 'type' => 'text', // @todo Change control type if needed |
34 | 34 | 'section' => $section_id, |
35 | - 'label' => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain |
|
36 | - 'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain |
|
35 | + 'label' => __('', 'my-text-domain'), // @todo Fill in label, update text domain |
|
36 | + 'description' => __('', 'my-text-domain'), // @todo Fill in description, update text domain |
|
37 | 37 | ), |
38 | 38 | ); |
39 | 39 | |
40 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
40 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
44 | -add_action( 'fields_register', 'example_my_term_starter' ); |
|
45 | 44 | \ No newline at end of file |
45 | +add_action('fields_register', 'example_my_term_starter'); |
|
46 | 46 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @param WP_Fields_API $wp_fields |
6 | 6 | */ |
7 | -function example_my_user_starter( $wp_fields ) { |
|
7 | +function example_my_user_starter($wp_fields) { |
|
8 | 8 | |
9 | 9 | // Object type: User |
10 | 10 | $object_type = 'user'; |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | $section_id = ''; // @todo Fill in section ID |
23 | 23 | |
24 | - $wp_fields->add_section( $object_type, $section_id, $object_name, array( |
|
25 | - 'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain |
|
24 | + $wp_fields->add_section($object_type, $section_id, $object_name, array( |
|
25 | + 'title' => __('', 'my-text-domain'), // @todo Fill in section heading, update text domain |
|
26 | 26 | 'screen' => $screen_id, |
27 | - ) ); |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | // My Field |
30 | 30 | $field_id = ''; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | 'control' => array( |
33 | 33 | 'type' => 'text', // @todo Change control type if needed |
34 | 34 | 'section' => $section_id, |
35 | - 'label' => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain |
|
36 | - 'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain |
|
35 | + 'label' => __('', 'my-text-domain'), // @todo Fill in label, update text domain |
|
36 | + 'description' => __('', 'my-text-domain'), // @todo Fill in description, update text domain |
|
37 | 37 | ), |
38 | 38 | ); |
39 | 39 | |
40 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
40 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
44 | -add_action( 'fields_register', 'example_my_user_starter' ); |
|
45 | 44 | \ No newline at end of file |
45 | +add_action('fields_register', 'example_my_user_starter'); |
|
46 | 46 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @param WP_Fields_API $wp_fields |
6 | 6 | */ |
7 | -function example_my_user_address( $wp_fields ) { |
|
7 | +function example_my_user_address($wp_fields) { |
|
8 | 8 | |
9 | 9 | // Object type: User |
10 | 10 | $object_type = 'user'; |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | $section_id = 'address'; |
23 | 23 | |
24 | - $wp_fields->add_section( $object_type, $section_id, $object_name, array( |
|
25 | - 'title' => __( 'Address', 'my-text-domain' ), // @todo Update text domain |
|
24 | + $wp_fields->add_section($object_type, $section_id, $object_name, array( |
|
25 | + 'title' => __('Address', 'my-text-domain'), // @todo Update text domain |
|
26 | 26 | 'screen' => $screen_id, |
27 | - ) ); |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | // Address Line 1 |
30 | 30 | $field_id = 'address_1'; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | 'control' => array( |
33 | 33 | 'type' => 'text', |
34 | 34 | 'section' => $section_id, |
35 | - 'label' => __( 'Address 1', 'my-text-domain' ), // @todo Update text domain |
|
35 | + 'label' => __('Address 1', 'my-text-domain'), // @todo Update text domain |
|
36 | 36 | ), |
37 | 37 | ); |
38 | 38 | |
39 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
39 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
40 | 40 | |
41 | 41 | // Address Line 2 |
42 | 42 | $field_id = 'address_2'; |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | 'control' => array( |
45 | 45 | 'type' => 'text', |
46 | 46 | 'section' => $section_id, |
47 | - 'label' => __( 'Address 2', 'my-text-domain' ), // @todo Update text domain |
|
47 | + 'label' => __('Address 2', 'my-text-domain'), // @todo Update text domain |
|
48 | 48 | ), |
49 | 49 | ); |
50 | 50 | |
51 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
51 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
52 | 52 | |
53 | 53 | // City |
54 | 54 | $field_id = 'address_city'; |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | 'control' => array( |
57 | 57 | 'type' => 'text', |
58 | 58 | 'section' => $section_id, |
59 | - 'label' => __( 'City', 'my-text-domain' ), // @todo Update text domain |
|
59 | + 'label' => __('City', 'my-text-domain'), // @todo Update text domain |
|
60 | 60 | ), |
61 | 61 | ); |
62 | 62 | |
63 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
63 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
64 | 64 | |
65 | 65 | // State / Region |
66 | 66 | $field_id = 'address_state'; |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | 'control' => array( |
69 | 69 | 'type' => 'text', |
70 | 70 | 'section' => $section_id, |
71 | - 'label' => __( 'State / Region', 'my-text-domain' ), // @todo Update text domain |
|
71 | + 'label' => __('State / Region', 'my-text-domain'), // @todo Update text domain |
|
72 | 72 | // You could use 'select' type instead and then |
73 | 73 | // pass in all states in 'choices' option with array( 'TX' => 'Texas' ) |
74 | 74 | ), |
75 | 75 | ); |
76 | 76 | |
77 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
77 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
78 | 78 | |
79 | 79 | // Zip / Postal Code |
80 | 80 | $field_id = 'address_zip'; |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | 'control' => array( |
83 | 83 | 'type' => 'text', |
84 | 84 | 'section' => $section_id, |
85 | - 'label' => __( 'Zip / Postal Code', 'my-text-domain' ), // @todo Update text domain |
|
85 | + 'label' => __('Zip / Postal Code', 'my-text-domain'), // @todo Update text domain |
|
86 | 86 | ), |
87 | 87 | ); |
88 | 88 | |
89 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
89 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
90 | 90 | |
91 | 91 | // Zip / Postal Code |
92 | 92 | $field_id = 'address_country'; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'control' => array( |
95 | 95 | 'type' => 'select', |
96 | 96 | 'section' => $section_id, |
97 | - 'label' => __( 'Country', 'my-text-domain' ), // @todo Update text domain |
|
97 | + 'label' => __('Country', 'my-text-domain'), // @todo Update text domain |
|
98 | 98 | 'choices' => array( |
99 | 99 | 'US' => 'United States', |
100 | 100 | 'CA' => 'Canada', |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | ), |
104 | 104 | ); |
105 | 105 | |
106 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
106 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
107 | 107 | |
108 | 108 | |
109 | 109 | } |
110 | -add_action( 'fields_register', 'example_my_user_address' ); |
|
111 | 110 | \ No newline at end of file |
111 | +add_action('fields_register', 'example_my_user_address'); |
|
112 | 112 | \ No newline at end of file |
@@ -22,32 +22,32 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * The absolute server path to the fields API directory. |
24 | 24 | */ |
25 | -define( 'WP_FIELDS_API_DIR', plugin_dir_path( __FILE__ ) ); |
|
25 | +define('WP_FIELDS_API_DIR', plugin_dir_path(__FILE__)); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * On `plugins_loaded`, create an instance of the Fields API manager class. |
29 | 29 | */ |
30 | 30 | function _wp_fields_api_include() { |
31 | 31 | |
32 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/fields-api/class-wp-fields-api.php' ); |
|
32 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/fields-api/class-wp-fields-api.php'); |
|
33 | 33 | |
34 | 34 | // Init Fields API class |
35 | 35 | $GLOBALS['wp_fields'] = WP_Fields_API::get_instance(); |
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | -add_action( 'plugins_loaded', '_wp_fields_api_include', 8 ); |
|
39 | +add_action('plugins_loaded', '_wp_fields_api_include', 8); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Implement Fields API Customizer instead of WP Core Customizer. |
43 | 43 | */ |
44 | 44 | function _wp_fields_api_customize_include() { |
45 | 45 | |
46 | - if ( ! ( ( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] ) || ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) ) ) ) { |
|
46 | + if ( ! ((isset($_REQUEST['wp_customize']) && 'on' == $_REQUEST['wp_customize']) || (is_admin() && 'customize.php' == basename($_SERVER['PHP_SELF'])))) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/class-wp-customize-manager.php' ); |
|
50 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/class-wp-customize-manager.php'); |
|
51 | 51 | |
52 | 52 | // Init Customize class |
53 | 53 | $GLOBALS['wp_customize'] = new WP_Customize_Manager; |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function _wp_fields_api_implementations() { |
64 | 64 | |
65 | - $implementation_dir = WP_FIELDS_API_DIR . 'implementation/wp-includes/fields-api/screens/'; |
|
65 | + $implementation_dir = WP_FIELDS_API_DIR.'implementation/wp-includes/fields-api/screens/'; |
|
66 | 66 | |
67 | 67 | // User |
68 | - require_once( $implementation_dir . 'class-wp-fields-api-screen-user-edit.php' ); |
|
68 | + require_once($implementation_dir.'class-wp-fields-api-screen-user-edit.php'); |
|
69 | 69 | |
70 | - WP_Fields_API_Screen_User_Edit::register( 'user', 'user-edit' ); |
|
70 | + WP_Fields_API_Screen_User_Edit::register('user', 'user-edit'); |
|
71 | 71 | |
72 | 72 | // Term |
73 | - require_once( $implementation_dir . 'class-wp-fields-api-screen-term.php' ); |
|
74 | - require_once( $implementation_dir . 'class-wp-fields-api-screen-term-add.php' ); |
|
73 | + require_once($implementation_dir.'class-wp-fields-api-screen-term.php'); |
|
74 | + require_once($implementation_dir.'class-wp-fields-api-screen-term-add.php'); |
|
75 | 75 | |
76 | - WP_Fields_API_Screen_Term::register( 'term', 'term-edit' ); |
|
77 | - WP_Fields_API_Screen_Term_Add::register( 'term', 'term-add' ); |
|
76 | + WP_Fields_API_Screen_Term::register('term', 'term-edit'); |
|
77 | + WP_Fields_API_Screen_Term_Add::register('term', 'term-add'); |
|
78 | 78 | |
79 | 79 | } |
80 | -add_action( 'fields_register', '_wp_fields_api_implementations', 5 ); |
|
80 | +add_action('fields_register', '_wp_fields_api_implementations', 5); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Implement Fields API User edit to override WP Core. |
@@ -86,20 +86,20 @@ discard block |
||
86 | 86 | |
87 | 87 | static $overridden; |
88 | 88 | |
89 | - if ( empty( $overridden ) ) { |
|
89 | + if (empty($overridden)) { |
|
90 | 90 | $overridden = true; |
91 | 91 | |
92 | 92 | // Load our overrides |
93 | 93 | //require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/includes/user.php' ); |
94 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/user-edit.php' ); |
|
94 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-admin/user-edit.php'); |
|
95 | 95 | |
96 | 96 | // Bail on original core file, don't run the rest |
97 | 97 | exit; |
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
101 | -add_action( 'load-user-edit.php', '_wp_fields_api_user_edit_include' ); |
|
102 | -add_action( 'load-profile.php', '_wp_fields_api_user_edit_include' ); |
|
101 | +add_action('load-user-edit.php', '_wp_fields_api_user_edit_include'); |
|
102 | +add_action('load-profile.php', '_wp_fields_api_user_edit_include'); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | |
110 | 110 | static $overridden; |
111 | 111 | |
112 | - if ( empty( $overridden ) ) { |
|
112 | + if (empty($overridden)) { |
|
113 | 113 | $overridden = true; |
114 | 114 | |
115 | 115 | // Load our overrides |
116 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/edit-tags.php' ); |
|
116 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-admin/edit-tags.php'); |
|
117 | 117 | |
118 | 118 | // Bail on original core file, don't run the rest |
119 | 119 | exit; |
120 | 120 | } |
121 | 121 | |
122 | 122 | } |
123 | -add_action( 'load-edit-tags.php', '_wp_fields_api_term_include' ); |
|
124 | 123 | \ No newline at end of file |
124 | +add_action('load-edit-tags.php', '_wp_fields_api_term_include'); |
|
125 | 125 | \ No newline at end of file |