Last active
June 5, 2020 12:49
-
-
Save ericnicolaas/0021bfecf925b5d95402e41db2971f28 to your computer and use it in GitHub Desktop.
Attendee fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fields_api->register_field( | |
new Charitable_Campaign_Field( | |
'attendees', | |
[ | |
'label' => 'Attendees', | |
'data_type' => 'meta', | |
'admin_form' => [ | |
'required' => false, | |
'section' => 'hike-details', | |
'type' => 'content', | |
'base_path' => __DIR__, | |
'view' => 'attendees-admin-field.php' | |
], | |
'campaign_form' => [ | |
'required' => false, | |
'section' => 'campaign-details', | |
'type' => 'content', | |
'priority' => 20, | |
'fullwidth' => true, | |
'content' => 'content goes here' | |
], | |
'show_in_export' => true, | |
] | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: In the
admin_form
section I set it up so you can create a view file for the field in the admin. To do that, add the above code to the Charitable Hikes plugin you have, and add a new file calledattendees-admin-field.php
.In that field, you can get the array of attendees like this: