Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

CPT Single

By: a guest on Sep 30th, 2011  |  syntax: PHP  |  size: 0.98 KB  |  views: 128  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /*
  3.  
  4.         Section: Content CPT
  5.         Author: Simon Prosser
  6.         Description: Load a CPT single template if available.
  7.         Version: 1.0.0
  8.        
  9. */
  10.  
  11. class PageLinesContentCPT extends PageLinesSection {
  12.  
  13.    function __construct( $registered_settings = array() ) {
  14.        
  15.                 $name = __('Content Area (CPT ENABLED)', 'pagelines');
  16.                 $id = 'maincontent';
  17.        
  18.                
  19.                 $settings = array(
  20.                         'description'   => 'This is the section that contains the main content for your site, including sidebars and page/post content.',
  21.                         'workswith'     => array('templates'),
  22.                         'failswith'             => array('404'),
  23.                        
  24.                         'icon'                  => PL_ADMIN_ICONS . '/document.png'
  25.                 );
  26.                
  27.  
  28.            parent::__construct($name, $id, $settings);    
  29.    }
  30.  
  31.    function section_template() {
  32.                 if ( file_exists( trailingslashit( STYLESHEETPATH ) . 'template.single-' . get_post_type() . '.php' ) )
  33.                         get_template_part( 'template.single-' . get_post_type() );
  34.                 else
  35.                         get_template_part( 'template.content' );
  36.         }
  37.  
  38. }
  39.  
  40. /*
  41.         End of section class
  42. */
  43.  
clone this paste RAW Paste Data