Created
November 13, 2014 17:49
-
-
Save cfxd/87067f475e1f2c6fc172 to your computer and use it in GitHub Desktop.
Populate Gravity Forms in an ACF select field named "subscribe_form_header"
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 | |
function populate_gravity_forms($field) { | |
if(class_exists('RGFormsModel')) { | |
$forms_array = array(); | |
$forms = RGFormsModel::get_forms(null, 'title'); | |
foreach($forms as $form) { | |
$forms_array[$form->id] = $form->title; | |
} | |
$field['choices'] = $forms_array; | |
} | |
return $field; | |
} | |
add_filter('acf/load_field/name=subscribe_form_header', 'populate_gravity_forms'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment