Commit b06512f 1 parent 0e2cbc3 commit b06512f Copy full SHA for b06512f
File tree 5 files changed +105
-1
lines changed
5 files changed +105
-1
lines changed Original file line number Diff line number Diff line change 1
1
* text =auto eol =lf
2
2
3
3
/tests export-ignore
4
+ /examples export-ignore
4
5
/.github export-ignore
5
6
/.editorconfig export-ignore
6
7
/.gitattributes export-ignore
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ register_extended_field_group([
51
51
]);
52
52
```
53
53
54
- [ Visit the official documentation to read more about the field group settings. ] ( https://www.advancedcustomfields.com/resources/register-fields-via-php#group-settings )
54
+ Find more examples in the [ examples directory ] ( examples ) or [ visit the official ACF documentation ] ( https://www.advancedcustomfields.com/resources/register-fields-via-php#group-settings ) to read more about the field group settings.
55
55
56
56
## Fields
57
57
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use WordPlate \Acf \Fields \Email ;
4
+ use WordPlate \Acf \Fields \Text ;
5
+ use WordPlate \Acf \Location ;
6
+
7
+ register_extended_field_group ([
8
+ 'title ' => 'Employee ' ,
9
+ 'fields ' => [
10
+ Text::make ('Title ' )
11
+ ->instructions ('Add the employee title. ' )
12
+ ->required (),
13
+ Email::make ('Email address ' , 'email ' )
14
+ ->instructions ('Add the employee email address. ' )
15
+ ->required (),
16
+ Text::make ('Phone number ' , 'phone ' )
17
+ ->instructions ('Add the employee phone number. ' ),
18
+ ],
19
+ 'location ' => [
20
+ Location::if ('post_type ' , 'employee ' ),
21
+ ],
22
+ ]);
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ // This example is registering a option page using ACF. Please see the
4
+ // documentation for more information:
5
+ // https://www.advancedcustomfields.com/resources/acf_add_options_page/
6
+
7
+ use WordPlate \Acf \Fields \Text ;
8
+ use WordPlate \Acf \Fields \Wysiwyg ;
9
+ use WordPlate \Acf \Location ;
10
+
11
+ acf_add_options_page ([
12
+ 'icon_url ' => 'dashicons-star-filled ' ,
13
+ 'menu_slug ' => 'cookie ' ,
14
+ 'page_title ' => 'Cookie ' ,
15
+ 'position ' => 21 ,
16
+ ]);
17
+
18
+ register_extended_field_group ([
19
+ 'title ' => 'Cookie ' ,
20
+ 'fields ' => [
21
+ Wysiwyg::make ('Text ' , 'cookie_text ' )
22
+ ->instructions ('Add the cookie disclaimer text. ' )
23
+ ->mediaUpload (false )
24
+ ->toolbar ('link ' )
25
+ ->tabs ('visual ' )
26
+ ->required (),
27
+ Text::make ('Label ' , 'cookie_label ' )
28
+ ->instructions ('Add the button label. ' )
29
+ ->required (),
30
+ ],
31
+ 'location ' => [
32
+ Location::if ('options_page ' , 'cookie ' ),
33
+ ],
34
+ ]);
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ // This example is using the Extended CPTs package to register custom post types
4
+ // and taxanomies. Please see the repository for more information:
5
+ // https://github.com/johnbillion/extended-cpts
6
+
7
+ use WordPlate \Acf \Fields \Wysiwyg ;
8
+ use WordPlate \Acf \Location ;
9
+
10
+ register_extended_post_type ('faq ' , [
11
+ 'menu_icon ' => 'dashicons-format-chat ' ,
12
+ 'has_archive ' => false ,
13
+ 'supports ' => ['title ' , 'revisions ' ],
14
+ 'admin_cols ' => [
15
+ 'category ' => [
16
+ 'taxonomy ' => 'topic ' ,
17
+ ],
18
+ ],
19
+ 'taxonomies ' => ['topic ' ],
20
+ ], [
21
+ 'singluar ' => 'FAQ ' ,
22
+ 'plural ' => 'FAQ ' ,
23
+ 'slug ' => 'faq ' ,
24
+ ]);
25
+
26
+ register_extended_taxonomy ('topic ' , 'faq ' , [
27
+ 'hierarchical ' => false ,
28
+ 'meta_box ' => 'radio ' ,
29
+ 'required ' => true ,
30
+ 'hierarchical ' => false ,
31
+ 'show_in_rest ' => true ,
32
+ ]);
33
+
34
+ register_extended_field_group ([
35
+ 'title ' => 'FAQ ' ,
36
+ 'fields ' => [
37
+ Wysiwyg::make ('Answer ' )
38
+ ->instructions ('Add the question answer. ' )
39
+ ->mediaUpload (false )
40
+ ->toolbar ('faq ' )
41
+ ->tabs ('visual ' )
42
+ ->required (),
43
+ ],
44
+ 'location ' => [
45
+ Location::if ('post_type ' , 'faq ' ),
46
+ ],
47
+ ]);
You can’t perform that action at this time.
0 commit comments