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 the ID of all Venues in a given Region (full region) | |
*/ | |
public function getVenueByRegion( $region=null ){ | |
$args = array( | |
'post_type' => 'tracks', | |
'posts_per_page' => -1, | |
'post_status' => 'published', | |
'meta_query' => array( |
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 | |
/** | |
* This file handles redirecting of our templates to our given views | |
* dir and anything else. | |
* | |
* Check if the themer has made a theme file in their | |
* theme dir, if not load our default. | |
* | |
* @uses template_redirect http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect | |
*/ |
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
// Snippet from events/index.html.php | |
<!-- Track --> | |
<div class="row"> | |
<h2 class="title"><?= $events->getTrackTitle( $post->ID ); ?></h2> | |
<div class="image-container"> | |
<img src="<?= $tracks->getMapImage( $events->getTrackId( $post->ID ), 'medium' ); ?>" /> | |
</div> | |
</div> | |
<!-- --> |
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 | |
/** | |
* Start auto loading | |
* | |
* Everything is based on the presence of a plugin/your-plugin/controller/{$post_type}_controller.php | |
* file if this file is present it is read and $post_type is paresed out and used for the model, js, | |
* and css file. If a css or js file isn't present one will be created for you given we can write to | |
* the dir. | |
*/ |
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 | |
if ( ! empty( $_FILES ) ) { | |
$media = new MediaUpload; | |
$uploaded_media = $media->saveUpload( $field_name='Filedata' ); | |
/** | |
* @todo MediaUpload does NOT handle resizing of images, | |
* normally its done in WordPress, but for some reason |
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 | |
/** | |
* You give me state, I give you abbreviation! | |
*/ | |
public function stateByAbbreviation( $abbr=null ){ | |
if ( is_null( $abbr ) ) | |
die('need abbr'); |
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 | |
add_action( 'template_redirect', 'boo' ); | |
function boo(){ | |
// ge the global post type | |
global $post_type; | |
// this is the one we want to match against |
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 | |
/** | |
* Usage: post_type_converter( 'tracks', 'venues'); | |
*/ | |
function post_type_converter( $from=null, $to=null, $post_id=null ){ | |
global $wpdb; | |
$query = "SELECT ID, post_type FROM $wpdb->posts WHERE post_type = '{$from}'"; |
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 | |
/** | |
* Rename meta keys | |
* Usage: update_meta_key( 'old_key', 'new_key'); | |
*/ | |
function update_meta_key( $old_key=null, $new_key=null ){ | |
global $wpdb; | |
$query = "UPDATE ".$wpdb->prefix."postmeta SET meta_key = '".$new_key."' WHERE meta_key = '".$old_key."'"; |
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 | |
$event = new Events(); | |
$event->post_type = array( | |
array( | |
'name' => 'Race Event', | |
'type' => 'events', | |
'has_one' => 'tracks', // add support 'has_many' => 'other_cpt' | |
'rewrite' => array( | |
'slug' => 'events' |