Advertisement
Guest User

CPT Loop

a guest
Sep 30th, 2011
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. <?php
  2. /*
  3.  
  4.     Section: CPT Loops
  5.     Author: Simon Prosser
  6.     Description: Adds CPT Control to loops.
  7.     Version: 1.0.0
  8.    
  9. */
  10.  
  11. class PageLinesPostLoopCPT extends PageLinesSection {
  12.  
  13.    function __construct( $registered_settings = array() ) {
  14.    
  15.         $name = __('Main Content <small>(The Loop - CPT ENABLED)</small>', 'pagelines');
  16.         $id = 'theloop';
  17.         $settings = array(
  18.             'type'          =>  'main',
  19.             'description'   => 'The Main Posts Loop. Includes content and post information',
  20.             'workswith'     =>  array( 'main-single', 'main-default', 'main-posts' ),
  21.             'icon'          => PL_ADMIN_ICONS . '/document.png'
  22.         );
  23.        parent::__construct($name, $id, $settings);    
  24.     global $pl_section_factory;
  25.     $pl_section_factory->sections['PageLinesPostLoop']->settings['required'] = 0;
  26.    }
  27.  
  28.     function section_persistent(){
  29.         $global_meta = array(
  30.             '_pagelines_layout_mode' => array(
  31.                 'type' => 'select',
  32.                 'selectvalues'=> array(
  33.                     'fullwidth'             => array( 'name' => 'Fullwidth layout', 'version' => 'pro' ),
  34.                     'one-sidebar-right'     => array( 'name' => 'One sidebar on right' ),
  35.                     'one-sidebar-left'      => array( 'name' => 'One sidebar on left' ),
  36.                     'two-sidebar-right'     => array( 'name' => 'Two sidebars on right', 'version' => 'pro' ),
  37.                     'two-sidebar-left'      => array( 'name' => 'Two sidebars on left', 'version' => 'pro' ),
  38.                     'two-sidebar-center'    => array( 'name' => 'Two sidebars, one on each side', 'version' => 'pro' ),
  39.                 ),
  40.                 'title' => 'Content Section - Select Layout Mode (optional)',
  41.                 'desc' => 'Use this option to change the content layout mode on this page.'
  42.             ),
  43.         );
  44.         add_global_meta_options( $global_meta );
  45.     }
  46.  
  47.    function section_template() {
  48.  
  49.         //Included in theme root for easy editing.
  50.         if ( is_post_type_archive() && file_exists( trailingslashit( STYLESHEETPATH ) . 'template.archive-' . get_post_type() . '.php' ) )
  51.             get_template_part( 'template.archive-' . get_post_type() );
  52.         else
  53.             get_template_part( 'template.postloop' );
  54.     }
  55.  
  56. } // end class
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement