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 | |
// Contents of controllers/tracks_controller.php | |
Class Tracks extends zMCustomPostTypeBase { | |
/** | |
* @todo derive this, based on $this->post_type['type'] | |
*/ | |
public $cpt = 'tracks'; |
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 is located in models/events.php | |
$tmp_cpt = 'events'; | |
$event = new Events(); | |
$event->post_type = array( | |
array( | |
'name' => 'Race Event', | |
'type' => $tmp_cpt, | |
'has_one' => 'tracks', // add support 'has_many' => 'other_cpt' |
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
// Old js snippet, would be better to move this to the template, the thing is if there's no results this should not be displayed. | |
new_header = '<tr><th class="attending">Add</th><th class="date">Date</th><th class="title">Event</th><th class="track">Track</th><th class="state">State</th></tr>'; | |
// snippet of search.js | |
// Start | |
var results_data_object = {"result":[]}; | |
results_data_object.result.push({ | |
id: this_result['ID'], | |
title: this_result['t'], | |
track: this_result['tr'], |
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
// The JS Template | |
<script id="result_event_tpl" type="text/html"> | |
{{#result}} | |
<tr> | |
<td> | |
<input type="checkbox" {{checked }} class="yes_no_handle {{ css_class }}" data-action="{{ action }}" data-current_user_id="{{ current_user }}" data-post_id="{{ id }}" /> | |
</td> | |
<td class="meta">{{ date }}</td> | |
<td> | |
<div class="title"> |
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 | |
/** | |
* Any Custom Post Type "should" automatically be routed based on the following: | |
*/ | |
add_action('template_redirect', function( $params=array() ) { | |
$post_type = null; | |
$taxonomy = get_query_var('taxonomy'); |
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 will auto load the following and/or create files if needed. | |
// | |
// plugin/controllers/$post_type_controller.php | |
// plugin/models/$post_type.php | |
// plugin/assets/stylesheets/$post_type.php | |
// plugin/assets/javascripts/$post_type.php | |
// | |
// note as of now the oder of the files is not important, we'll cross |
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 is used to regsiter a custom post type, custom taxonomy and provide template redirecting. | |
* | |
* This abstract class defines some base functions for using Custom Post Types. You should not have to | |
* edit this abstract, only add additional methods if need be. You must use what is provided for you | |
* in the interface. | |
* | |
*/ |
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 | |
/** | |
* Determine if given templates exists if they do loads them | |
* based on the type of page being displayed. | |
* | |
* @uses is_single() | |
*/ | |
if ( ! function_exists( '_zm_template_redirect' ) ) : | |
function _zm_template_redirect( $params=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 | |
/** | |
* An "easier" interface for interacting with WordPress' template_redirect function. | |
* | |
* @package zm-wordpress-helpers | |
* @uses is_admin() | |
* @uses get_query_var() | |
*/ | |
function bmx_race_schedule_redirect( $params=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 | |
ini_set('display_errors', 'on'); | |
error_reporting( E_ALL ); | |
/** | |
* Settings | |
*/ | |
global $_closure; | |
global $_p_head_dir; |