Created
October 6, 2011 20:51
-
-
Save zanematthew/1268641 to your computer and use it in GitHub Desktop.
Sample class
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
class CustomPostType extends CustomPostTypeBase { | |
/** | |
* Every thing that is "custom" to our CPT goes here. | |
*/ | |
public function __construct() { | |
$this->dependencies['script'] = array( | |
'jquery', | |
'jquery-ui-core', | |
'jquery-ui-dialog' | |
); | |
$this->dependencies['style'] = array( | |
'tt-base-style' | |
); | |
add_action( 'init', array( &$this, 'registerPostType' ) ); | |
add_action( 'init', array( &$this, 'registerTaxonomy' ) ); | |
add_action( 'template_redirect', array( &$this, 'templateRedirect' ) ); | |
/** @todo consider, moving the following to the abstract */ | |
add_action( 'wp_head', array( &$this, 'baseAjaxUrl' ) ); | |
// @todo move to abstract | |
add_action( 'wp_ajax_loadTemplate', array( &$this, 'loadTemplate' ) ); | |
// @todo move to abstract | |
add_action( 'wp_ajax_nopriv_loadTemplate', array( &$this, 'loadTemplate' ) ); // for public use | |
// @todo move to abstract | |
add_filter( 'post_class', array( &$this, 'addPostClass' ) ); | |
// Only our container divs are loaded, the contents is injected via ajax :) | |
// @todo createDiv( $element_id=null ) | |
add_action( 'wp_footer', array( &$this, 'createPostTypeDiv' ) ); | |
add_action( 'wp_footer', array( &$this, 'createDeleteDiv' ) ); | |
// @todo see if we can move this to the abstract | |
add_action( 'wp_ajax_postTypeSubmit', array( &$this, 'postTypeSubmit' ) ); | |
add_action( 'wp_ajax_postTypeUpdate', array( &$this, 'postTypeUpdate' ) ); | |
add_action( 'wp_ajax_postTypeDelete', array( &$this, 'postTypeDelete' ) ); | |
add_action( 'wp_ajax_defaultUtilityUpdate', array( &$this, 'defaultUtilityUpdate' ) ); | |
add_action( 'wp_ajax_addComment', array( &$this, 'addComment' ) ); | |
register_activation_hook( __FILE__, array( &$this, 'regsiterActivation') ); | |
// and so on.. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment