Created
May 16, 2019 16:38
-
-
Save messica/e3a71ce03911126aae852c9cbcb23bbd to your computer and use it in GitHub Desktop.
Register Helper example: custom taxonomy select2 field
This file contains hidden or 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 | |
| // Get custom taxonomy terms. | |
| $cause_categories = get_terms( array( | |
| 'taxonomy' => 'cause-category', | |
| ) ); | |
| $options = array(); | |
| foreach ( $cause_categories as $key => $category ) { | |
| $options[$category->term_id] = $category->name; | |
| } | |
| $fields[] = new PMProRH_Field('cause_category', 'select2', array( | |
| 'label' => 'Cause Category', | |
| 'profile' => true, | |
| 'options' => $options, | |
| ) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment