Skip to content

Instantly share code, notes, and snippets.

@bryanmonzon
Created September 9, 2014 22:14
Show Gist options
  • Save bryanmonzon/fb5953634700e9513925 to your computer and use it in GitHub Desktop.
Save bryanmonzon/fb5953634700e9513925 to your computer and use it in GitHub Desktop.
Grab a list of Gravity Form IDs for use in post meta
<?php
if( class_exists( 'RGFormsModel' ) ){
$select = '<select name="s_camps_gforms_id">';
$select .= '<option>--No Form</option>';
$forms = RGFormsModel::get_forms( null, 'title' );
foreach( $forms as $form ) {
$select .= '<option id="' . $form->id . '" value="'. $form->id.'" '. selected( $s_camps_gforms_id, $form->id, false).'>' . $form->title . '</option>';
}
$select .= '</select>';
?>
<p>
<strong>Select a donation form</strong>
<?php echo $select; ?><br>
<em class="hint">You must have Gravity Forms installed</em>
</p>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment