Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created August 11, 2012 05:16
Show Gist options
  • Save zanematthew/3321345 to your computer and use it in GitHub Desktop.
Save zanematthew/3321345 to your computer and use it in GitHub Desktop.
Methods for our Venues Controller
<?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