@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'type' => 'text', |
70 | 70 | 'section' => $section_id, |
71 | 71 | 'label' => __( 'State / Region', 'my-text-domain' ), // @todo Update text domain |
72 | - // You could use 'select' type instead and then |
|
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 | ); |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | 'type' => 'select', |
96 | 96 | 'section' => $section_id, |
97 | 97 | 'label' => __( 'Country', 'my-text-domain' ), // @todo Update text domain |
98 | - 'choices' => array( |
|
99 | - 'US' => 'United States', |
|
100 | - 'CA' => 'Canada', |
|
101 | - // Add more here as needed, or use 'text' type instead for freeform |
|
102 | - ), |
|
98 | + 'choices' => array( |
|
99 | + 'US' => 'United States', |
|
100 | + 'CA' => 'Canada', |
|
101 | + // Add more here as needed, or use 'text' type instead for freeform |
|
102 | + ), |
|
103 | 103 | ), |
104 | 104 | ); |
105 | 105 |
@@ -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,11 +21,11 @@ discard block |
||
21 | 21 | |
22 | 22 | $section_id = 'address'; |
23 | 23 | $section_args = array( |
24 | - 'title' => __( 'Address', 'my-text-domain' ), // @todo Update text domain |
|
24 | + 'title' => __('Address', 'my-text-domain'), // @todo Update text domain |
|
25 | 25 | 'screen' => $screen_id, |
26 | 26 | ); |
27 | 27 | |
28 | - $wp_fields->add_section( $object_type, $section_id, $object_name, $section_args ); |
|
28 | + $wp_fields->add_section($object_type, $section_id, $object_name, $section_args); |
|
29 | 29 | |
30 | 30 | // Address Line 1 |
31 | 31 | $field_id = 'address_1'; |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | 'control' => array( |
34 | 34 | 'type' => 'text', |
35 | 35 | 'section' => $section_id, |
36 | - 'label' => __( 'Address 1', 'my-text-domain' ), // @todo Update text domain |
|
36 | + 'label' => __('Address 1', 'my-text-domain'), // @todo 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 | // Address Line 2 |
43 | 43 | $field_id = 'address_2'; |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | 'control' => array( |
46 | 46 | 'type' => 'text', |
47 | 47 | 'section' => $section_id, |
48 | - 'label' => __( 'Address 2', 'my-text-domain' ), // @todo Update text domain |
|
48 | + 'label' => __('Address 2', 'my-text-domain'), // @todo Update text domain |
|
49 | 49 | ), |
50 | 50 | ); |
51 | 51 | |
52 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
52 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
53 | 53 | |
54 | 54 | // City |
55 | 55 | $field_id = 'address_city'; |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | 'control' => array( |
58 | 58 | 'type' => 'text', |
59 | 59 | 'section' => $section_id, |
60 | - 'label' => __( 'City', 'my-text-domain' ), // @todo Update text domain |
|
60 | + 'label' => __('City', 'my-text-domain'), // @todo Update text domain |
|
61 | 61 | ), |
62 | 62 | ); |
63 | 63 | |
64 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
64 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
65 | 65 | |
66 | 66 | // State / Region |
67 | 67 | $field_id = 'address_state'; |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | 'control' => array( |
70 | 70 | 'type' => 'text', |
71 | 71 | 'section' => $section_id, |
72 | - 'label' => __( 'State / Region', 'my-text-domain' ), // @todo Update text domain |
|
72 | + 'label' => __('State / Region', 'my-text-domain'), // @todo Update text domain |
|
73 | 73 | // You could use 'select' type instead and then |
74 | 74 | // pass in all states in 'choices' option with array( 'TX' => 'Texas' ) |
75 | 75 | ), |
76 | 76 | ); |
77 | 77 | |
78 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
78 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
79 | 79 | |
80 | 80 | // Zip / Postal Code |
81 | 81 | $field_id = 'address_zip'; |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | 'control' => array( |
84 | 84 | 'type' => 'text', |
85 | 85 | 'section' => $section_id, |
86 | - 'label' => __( 'Zip / Postal Code', 'my-text-domain' ), // @todo Update text domain |
|
86 | + 'label' => __('Zip / Postal Code', 'my-text-domain'), // @todo Update text domain |
|
87 | 87 | ), |
88 | 88 | ); |
89 | 89 | |
90 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
90 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
91 | 91 | |
92 | 92 | // Zip / Postal Code |
93 | 93 | $field_id = 'address_country'; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'control' => array( |
96 | 96 | 'type' => 'select', |
97 | 97 | 'section' => $section_id, |
98 | - 'label' => __( 'Country', 'my-text-domain' ), // @todo Update text domain |
|
98 | + 'label' => __('Country', 'my-text-domain'), // @todo Update text domain |
|
99 | 99 | 'choices' => array( |
100 | 100 | 'US' => 'United States', |
101 | 101 | 'CA' => 'Canada', |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
107 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
107 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
108 | 108 | |
109 | 109 | |
110 | 110 | } |
111 | -add_action( 'fields_register', 'example_my_user_address' ); |
|
112 | 111 | \ No newline at end of file |
112 | +add_action('fields_register', 'example_my_user_address'); |
|
113 | 113 | \ 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_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,11 +21,11 @@ discard block |
||
21 | 21 | |
22 | 22 | $section_id = ''; // @todo Fill in section ID |
23 | 23 | $section_args = array( |
24 | - 'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain |
|
24 | + 'title' => __('', 'my-text-domain'), // @todo Fill in section heading, update text domain |
|
25 | 25 | 'screen' => $screen_id, |
26 | 26 | ); |
27 | 27 | |
28 | - $wp_fields->add_section( $object_type, $section_id, $object_name, $section_args ); |
|
28 | + $wp_fields->add_section($object_type, $section_id, $object_name, $section_args); |
|
29 | 29 | |
30 | 30 | // My Field |
31 | 31 | $field_id = ''; |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | 'control' => array( |
34 | 34 | 'type' => 'text', // @todo Change control type if needed |
35 | 35 | 'section' => $section_id, |
36 | - 'label' => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain |
|
37 | - 'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain |
|
36 | + 'label' => __('', 'my-text-domain'), // @todo Fill in label, update text domain |
|
37 | + 'description' => __('', 'my-text-domain'), // @todo Fill in description, update text domain |
|
38 | 38 | ), |
39 | 39 | ); |
40 | 40 | |
41 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
41 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | } |
45 | -add_action( 'fields_register', 'example_my_term_starter' ); |
|
46 | 45 | \ No newline at end of file |
46 | +add_action('fields_register', 'example_my_term_starter'); |
|
47 | 47 | \ 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,11 +21,11 @@ discard block |
||
21 | 21 | |
22 | 22 | $section_id = ''; // @todo Fill in section ID |
23 | 23 | $section_args = array( |
24 | - 'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain |
|
24 | + 'title' => __('', 'my-text-domain'), // @todo Fill in section heading, update text domain |
|
25 | 25 | 'screen' => $screen_id, |
26 | 26 | ); |
27 | 27 | |
28 | - $wp_fields->add_section( $object_type, $section_id, $object_name, $section_args ); |
|
28 | + $wp_fields->add_section($object_type, $section_id, $object_name, $section_args); |
|
29 | 29 | |
30 | 30 | // My Field |
31 | 31 | $field_id = ''; |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | 'control' => array( |
34 | 34 | 'type' => 'text', // @todo Change control type if needed |
35 | 35 | 'section' => $section_id, |
36 | - 'label' => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain |
|
37 | - 'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain |
|
36 | + 'label' => __('', 'my-text-domain'), // @todo Fill in label, update text domain |
|
37 | + 'description' => __('', 'my-text-domain'), // @todo Fill in description, update text domain |
|
38 | 38 | ), |
39 | 39 | ); |
40 | 40 | |
41 | - $wp_fields->add_field( $object_type, $field_id, $object_name, $field_args ); |
|
41 | + $wp_fields->add_field($object_type, $field_id, $object_name, $field_args); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | } |
45 | -add_action( 'fields_register', 'example_my_user_starter' ); |
|
46 | 45 | \ No newline at end of file |
46 | +add_action('fields_register', 'example_my_user_starter'); |
|
47 | 47 | \ No newline at end of file |
@@ -22,7 +22,7 @@ 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. |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | function _wp_fields_api_include() { |
31 | 31 | |
32 | 32 | // Bail if we're already in WP core (depending on the name used) |
33 | - if ( class_exists( 'WP_Fields_API' ) || class_exists( 'Fields_API' ) ) { |
|
33 | + if (class_exists('WP_Fields_API') || class_exists('Fields_API')) { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
37 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/fields-api/class-wp-fields-api.php' ); |
|
37 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/fields-api/class-wp-fields-api.php'); |
|
38 | 38 | |
39 | 39 | // Init Fields API class |
40 | 40 | $GLOBALS['wp_fields'] = WP_Fields_API::get_instance(); |
41 | 41 | |
42 | 42 | } |
43 | 43 | |
44 | -add_action( 'plugins_loaded', '_wp_fields_api_include', 8 ); |
|
44 | +add_action('plugins_loaded', '_wp_fields_api_include', 8); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Implement Fields API Customizer instead of WP Core Customizer. |
48 | 48 | */ |
49 | 49 | function _wp_fields_api_customize_include() { |
50 | 50 | |
51 | - if ( ! ( ( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] ) || ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) ) ) ) { |
|
51 | + if ( ! ((isset($_REQUEST['wp_customize']) && 'on' == $_REQUEST['wp_customize']) || (is_admin() && 'customize.php' == basename($_SERVER['PHP_SELF'])))) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/class-wp-customize-manager.php' ); |
|
55 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/class-wp-customize-manager.php'); |
|
56 | 56 | |
57 | 57 | // Init Customize class |
58 | 58 | $GLOBALS['wp_customize'] = new WP_Customize_Manager; |
@@ -67,33 +67,33 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function _wp_fields_api_implementations() { |
69 | 69 | |
70 | - $implementation_dir = WP_FIELDS_API_DIR . 'implementation/wp-includes/fields-api/forms/'; |
|
70 | + $implementation_dir = WP_FIELDS_API_DIR.'implementation/wp-includes/fields-api/forms/'; |
|
71 | 71 | |
72 | 72 | // User |
73 | - require_once( $implementation_dir . 'class-wp-fields-api-form-user-edit.php' ); |
|
73 | + require_once($implementation_dir.'class-wp-fields-api-form-user-edit.php'); |
|
74 | 74 | |
75 | - WP_Fields_API_Form_User_Edit::register( 'user', 'user-edit' ); |
|
75 | + WP_Fields_API_Form_User_Edit::register('user', 'user-edit'); |
|
76 | 76 | |
77 | 77 | // Term |
78 | - require_once( $implementation_dir . 'class-wp-fields-api-form-term.php' ); |
|
79 | - require_once( $implementation_dir . 'class-wp-fields-api-form-term-add.php' ); |
|
78 | + require_once($implementation_dir.'class-wp-fields-api-form-term.php'); |
|
79 | + require_once($implementation_dir.'class-wp-fields-api-form-term-add.php'); |
|
80 | 80 | |
81 | - WP_Fields_API_Form_Term::register( 'term', 'term-edit' ); |
|
82 | - WP_Fields_API_Form_Term_Add::register( 'term', 'term-add' ); |
|
81 | + WP_Fields_API_Form_Term::register('term', 'term-edit'); |
|
82 | + WP_Fields_API_Form_Term_Add::register('term', 'term-add'); |
|
83 | 83 | |
84 | 84 | // Settings |
85 | - require_once( $implementation_dir . 'settings/class-wp-fields-api-form-settings-general.php' ); |
|
85 | + require_once($implementation_dir.'settings/class-wp-fields-api-form-settings-general.php'); |
|
86 | 86 | |
87 | - WP_Fields_API_Form_Settings_General::register( 'settings', 'general' ); |
|
87 | + WP_Fields_API_Form_Settings_General::register('settings', 'general'); |
|
88 | 88 | |
89 | 89 | // Settings API compatibility |
90 | - require_once( $implementation_dir . 'settings/class-wp-fields-api-settings-api.php' ); |
|
90 | + require_once($implementation_dir.'settings/class-wp-fields-api-settings-api.php'); |
|
91 | 91 | |
92 | 92 | // Run Settings API compatibility (has it's own hooks) |
93 | 93 | new WP_Fields_API_Settings_API; |
94 | 94 | |
95 | 95 | } |
96 | -add_action( 'fields_register', '_wp_fields_api_implementations', 5 ); |
|
96 | +add_action('fields_register', '_wp_fields_api_implementations', 5); |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Implement Fields API User edit to override WP Core. |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | |
103 | 103 | static $overridden; |
104 | 104 | |
105 | - if ( empty( $overridden ) ) { |
|
105 | + if (empty($overridden)) { |
|
106 | 106 | $overridden = true; |
107 | 107 | |
108 | 108 | // Load our overrides |
109 | 109 | //require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/includes/user.php' ); |
110 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/user-edit.php' ); |
|
110 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-admin/user-edit.php'); |
|
111 | 111 | |
112 | 112 | // Bail on original core file, don't run the rest |
113 | 113 | exit; |
114 | 114 | } |
115 | 115 | |
116 | 116 | } |
117 | -add_action( 'load-user-edit.php', '_wp_fields_api_user_edit_include' ); |
|
118 | -add_action( 'load-profile.php', '_wp_fields_api_user_edit_include' ); |
|
117 | +add_action('load-user-edit.php', '_wp_fields_api_user_edit_include'); |
|
118 | +add_action('load-profile.php', '_wp_fields_api_user_edit_include'); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | /** |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | |
126 | 126 | static $overridden; |
127 | 127 | |
128 | - if ( empty( $overridden ) ) { |
|
128 | + if (empty($overridden)) { |
|
129 | 129 | $overridden = true; |
130 | 130 | |
131 | 131 | // Load our overrides |
132 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/edit-tags.php' ); |
|
132 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-admin/edit-tags.php'); |
|
133 | 133 | |
134 | 134 | // Bail on original core file, don't run the rest |
135 | 135 | exit; |
136 | 136 | } |
137 | 137 | |
138 | 138 | } |
139 | -add_action( 'load-edit-tags.php', '_wp_fields_api_term_include' ); |
|
139 | +add_action('load-edit-tags.php', '_wp_fields_api_term_include'); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Implement Fields API Term to override WP Core. |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | |
146 | 146 | static $overridden; |
147 | 147 | |
148 | - if ( empty( $overridden ) ) { |
|
148 | + if (empty($overridden)) { |
|
149 | 149 | $overridden = true; |
150 | 150 | |
151 | 151 | // Load our overrides |
152 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-admin/settings-general.php' ); |
|
152 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-admin/settings-general.php'); |
|
153 | 153 | |
154 | 154 | // Bail on original core file, don't run the rest |
155 | 155 | exit; |
156 | 156 | } |
157 | 157 | |
158 | 158 | } |
159 | -add_action( 'load-options-general.php', '_wp_fields_api_settings_general_include' ); |
|
160 | 159 | \ No newline at end of file |
160 | +add_action('load-options-general.php', '_wp_fields_api_settings_general_include'); |
|
161 | 161 | \ No newline at end of file |