Completed
Push — master ( b833e1...b12226 )
by Scott Kingsley
11s
created

_starter.php ➔ example_my_user_starter()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 17

Duplication

Lines 38
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 1
dl 38
loc 38
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Register Fields API configuration
4
 *
5
 * @param WP_Fields_API $wp_fields
6
 */
7 View Code Duplication
function example_my_user_starter( $wp_fields ) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
9
	// Object type: User
10
	$object_type = 'user';
11
12
	// Object name: n/a
13
	$object_name = null;
14
15
	// Form: User Edit Profile
16
	$form_id = 'user-edit';
17
18
	/////////////////////////
19
	// Section: My Section //
20
	/////////////////////////
21
22
	$section_id   = ''; // @todo Fill in section ID
23
	$section_args = array(
24
		'title' => __( '', 'my-text-domain' ), // @todo Fill in section heading, update text domain
25
		'form'  => $form_id,
26
	);
27
28
	$wp_fields->add_section( $object_type, $section_id, $object_name, $section_args );
29
30
	// My Field
31
	$field_id   = '';
32
	$field_args = array(
33
		// You can register a control for this field at the same time
34
		'control' => array(
35
			'type'        => 'text', // @todo Change control type if needed
36
			'section'     => $section_id,
37
			'label'       => __( '', 'my-text-domain' ), // @todo Fill in label, update text domain
38
			'description' => __( '', 'my-text-domain' ), // @todo Fill in description, update text domain
39
		),
40
	);
41
42
	$wp_fields->add_field( $object_type, $field_id, $object_name, $field_args );
43
44
}
45
46
add_action( 'fields_register', 'example_my_user_starter' );