Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Created May 19, 2016 20:30
Show Gist options
  • Save ronalfy/19c7ac96e434a5855a0034eeee28267b to your computer and use it in GitHub Desktop.
Save ronalfy/19c7ac96e434a5855a0034eeee28267b to your computer and use it in GitHub Desktop.
Custom Post Type Templates Constructor Area
<?php
/*
Plugin Name: CPT Templates
Plugin URI: http://www.riversportokc.org/
Description: Create Custom Post Type Templates
Author: BigWing Interactive
Version: 1.0.0
Requires at least: 4.1
Author URI: http://bigwing.com
Contributors: ronalfy, bigwing
*/
class CPT_Templates {
private static $instance = null;
private $post_types = '';
//Singleton
public static function get_instance() {
if ( null == self::$instance ) {
self::$instance = new self;
}
return self::$instance;
} //end get_instance
private function __construct() {
add_action( 'init', array( &$this, 'init' ), 9 );
add_action( 'save_post', array( &$this, 'save_post' ) );
add_filter( 'template_include', array( &$this, 'maybe_get_cpt_template' ) );
$this->post_types = array(
'gallery',
'book'
);
} //end init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment