Created
August 11, 2012 05:16
-
-
Save zanematthew/3321345 to your computer and use it in GitHub Desktop.
Methods for our Venues Controller
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 | |
/** | |
* Returns a object of ALL venues ids | |
*/ | |
public function IDs(){ | |
global $wpdb; | |
$query = "select ID from {$wpdb->prefix}posts where post_type = 'venues' and post_status = 'publish'"; | |
$tmp = array(); | |
foreach ( $wpdb->get_results( $query ) as $wtf ){ | |
$tmp[] = $wtf->ID; | |
} | |
return $tmp; | |
} | |
/** | |
* Return the name, i.e., title | |
* @param $id | |
*/ | |
public function getName( $id ){ | |
return get_the_title( $id ); | |
} | |
/** | |
* Returns the contacts email address | |
* @param $id | |
*/ | |
public function contactEmail( $id ){ | |
return filter_var( get_post_meta( $id, "venues_email", true ), FILTER_VALIDATE_EMAIL ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment