Created
August 31, 2011 05:06
-
-
Save curtismchale/1182856 to your computer and use it in GitHub Desktop.
Populates GF dropdown
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
/* | |
* Load any taxonomy terms | |
*/ | |
function load_cpt_choices($post_type, $type, $first_choice = '', $term) { | |
$choices = array(); | |
if ($type === 'select') { | |
$posts = get_posts('post_type='.$post_type.'&numberposts=-1&school_type='.$term); | |
} | |
if( $post_type == 'school' ){ | |
foreach($posts as $post) { | |
$hsZip = get_post_meta( $post->ID, 'sfn_tan_hs_zip', true); | |
$hsState = get_post_meta( $post->ID, 'sfn_tan_hs_state', true); | |
$hsName = $post->post_title; | |
$hsString = $hsZip . ', '. $hsName . ', ' . $hsState; | |
$choices[] = array('value' => $post->ID, 'text' => $hsString); | |
} | |
} else { | |
foreach( $posts as $post ){ | |
$choices[] = array( 'value' => $post->ID, 'text' => $post->post_title ); | |
} | |
} | |
return $choices; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment