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 | |
/** | |
* 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
// 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
// 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
<?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
<?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 | |
add_action('template_redirect', function() { | |
$tmp = explode( '/', $_SERVER['REQUEST_URI'] ); | |
$my_slug = 'feeds'; | |
if ( isset( $tmp ) && $tmp[1] == $my_slug ) { | |
load_template( '/path/to/my/template/' ); | |
// or do what ever you want | |
exit(); |
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 | |
// more stuff done here | |
/** | |
* 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 |
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 ( $event ) : ?> | |
<h1><a href="<?= $event['link']; ?>"><?= $event['title']; ?></a></h1> | |
<p class="date-time"><time class="post-time"><?= $event['date']; ?></time></p> | |
<div style="float: left;"> | |
<ul class="inline" style="margin: 10px 0 0;"> | |
<li style="margin-top: -12px; float: left;"><?php load_template( VIEWS_DIR . 'shared/facebook-button.html.php' ); ?></li> | |
<li><?php load_template( VIEWS_DIR . 'shared/twitter-like-button.html.php' ); ?></li> | |
</ul> | |
</div> | |
<?php else : ?> |
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 | |
public function randomBanner(){ | |
$obj_local_venues = new Tracks; | |
$local_venues = $obj_local_venues->getLocalVenues(); | |
$venue_ids = array(); | |
foreach( $local_venues as $venue ){ |