Advertisement
Guest User

Features section

a guest
Aug 11th, 2011
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.08 KB | None | 0 0
  1. <?php
  2. /*
  3.  
  4.     Section: PageLines Features
  5.     Author: Andrew Powers
  6.     Description: Creates a feature slider and custom post type
  7.     Version: 1.0.1
  8.    
  9. */
  10.  
  11. class PageLinesFeatures extends PageLinesSection {
  12.  
  13.    function __construct( $registered_settings = array() ) {
  14.    
  15.         $name = __('PageLines Features', 'pagelines');
  16.         $id = 'feature';
  17.        
  18.         $this->tax_id = 'feature-sets';
  19.         $this->section_root_url = $registered_settings['base_url'];
  20.        
  21.         $default_settings = array(
  22.             'description'   => 'This is your main feature slider.  Add feature text and media through the admin panel.',
  23.             'icon'          => $this->section_root_url.'/features.png',
  24.             'version'       => 'pro',  
  25.         );
  26.        
  27.         $settings = wp_parse_args( $registered_settings, $default_settings );
  28.        
  29.        parent::__construct($name, $id, $settings);    
  30.    }
  31.  
  32.     function section_persistent(){
  33.        
  34.         /*
  35.             Create Custom Post Type
  36.         */
  37.             $args = array(
  38.                     'label'             => __('Features', 'pagelines'),  
  39.                     'singular_label'    => __('Feature', 'pagelines'),
  40.                     'description'       => 'For setting slides on the feature page template',
  41.                     'taxonomies'        => array('feature-sets'),
  42.                 );
  43.             $taxonomies = array(
  44.                 'feature-sets' => array(   
  45.                         "label" => __('Feature Sets', 'pagelines'),
  46.                         "singular_label" => __('Feature Set', 'pagelines'),
  47.                     )
  48.             );
  49.             $columns = array(
  50.                 "cb"                    => "<input type=\"checkbox\" />",
  51.                 "title"                 => "Title",
  52.                 "feature-description"   => "Text",
  53.                 "feature-media"         => "Media",
  54.                 "feature-sets"          => "Feature Sets"
  55.             );
  56.        
  57.             $column_value_function = 'feature_column_display';
  58.        
  59.             $this->post_type = new PageLinesPostType($this->id, $args, $taxonomies, $columns, $column_value_function);
  60.        
  61.                 /* Set default posts if none are present */
  62.                
  63.                 $this->post_type->set_default_posts('pagelines_default_features');
  64.        
  65.         /*
  66.             Create meta fields for the post type
  67.         */
  68.             $type_meta_array = array(
  69.                     'feature-style' => array(
  70.                             'type'  => 'select',                   
  71.                             'title' => 'Feature Text Position',
  72.                             'desc'  => 'Select the type of feature style you would like to be shown. E.g. show text on left, right, bottom or not at all (full width)...',
  73.                             'selectvalues' => array(
  74.                                 'text-left'     => 'Text On Left',
  75.                                 'text-right'    => 'Text On Right',
  76.                                 'text-bottom'   => 'Text On Bottom',
  77.                                 'text-none'     => 'Full Width Image or Media - No Text'
  78.                             ),
  79.                         ),
  80.                     'feature-background-image' => array(
  81.                             'desc'          => 'Upload an image for the feature background.',
  82.                             'title'         => 'Feature Background Image',
  83.                             'type'          => 'image_upload'
  84.                         ),
  85.                    
  86.                     'feature-design' => array(
  87.                             'type'          => 'select',
  88.                             'desc'          => 'Select the design style you would like this feature to have (e.g. default background color, text color, overlay? etc...).',
  89.                             'title'     => 'Feature Design Style',
  90.                             'selectvalues' => array(
  91.                                 'fstyle-darkbg-overlay' => 'White Text - Dark Feature Background - Transparent Text Overlay (Default)',
  92.                                 'fstyle-lightbg'        => 'Black Text - Light Feature Background with Border - No Overlay',
  93.                                 'fstyle-darkbg'         => 'White Text - Dark Feature Background - No Overlay',
  94.                                 'fstyle-nobg'           => 'Black Text - No Feature Background - No Overlay',
  95.                             ),
  96.                         ),
  97.                        
  98.                     'feature-media-image' => array(
  99.                             'version'       => 'pro',
  100.                             'type'          => 'image_upload',                 
  101.                             'title'         => 'Feature Media Image',
  102.                             'label'         => 'Upload An Image For The Feature Media Area',
  103.                             'desc'          => 'Upload an image of the appropriate size for the feature media area.'
  104.                         ),
  105.                     'feature-media' => array(
  106.                             'version'       => 'pro',
  107.                             'type'          => 'textarea',                 
  108.                             'title'         => 'Feature Media HTML (Youtube, Flash etc...)',
  109.                             'label'         => 'Enter HTML For Feature Media Area',
  110.                             'desc'          => 'Feature Page Media HTML or Embed Code.'
  111.                         ),
  112.                     'feature-thumb' => array(
  113.                             'desc'          => 'Add thumbnails to your post for use in thumb navigation. Create an image 50px wide by 30px tall and upload here.',
  114.                             'title'         => 'Feature Thumb (50px by 30px)',
  115.                             'label'         => 'Upload Feature Thumbnail (Thumbs Mode)',
  116.                             'type'          => 'image_upload'
  117.                         ),
  118.                     'feature-link-url' => array(
  119.                             'desc'          => 'Adding a URL here will add a link to your feature slide',
  120.                             'title'         => 'Feature Link URL',
  121.                             'label'         => 'Enter Feature Link URL',
  122.                             'type'          => 'text'
  123.                         ),
  124.                     'feature-link-text' => array(
  125.                             'default'       => 'More',
  126.                             'desc'          => 'Enter the text you would like in your feature link',
  127.                             'title'         => 'Link Text',
  128.                             'label'         => 'Enter Feature Link Text',
  129.                             'type'          => 'text',
  130.                             'size'          => 'small'
  131.                         ),
  132.                     'feature-name' => array(
  133.                             'default'       => '',
  134.                             'desc'          => 'Enter the title you would like to appear when the feature nav mode is set to feature names',
  135.                             'title'         => 'Navigation Label',
  136.                             'label'         => 'Enter Feature Navigation Text (Names Nav Mode)',
  137.                             'type'          => 'text'
  138.                         ),
  139.        
  140.             );
  141.            
  142.             // Add options for correct post type.
  143.             $post_types = (pagelines('feature_source') == 'posts') ? array($this->id, 'post') : array($this->id);
  144.            
  145.             $type_metapanel_settings = array(
  146.                     'id'        => 'feature-metapanel',
  147.                     'name'      => "Feature Setup Options",
  148.                     'posttype'  => $post_types,
  149.                     'hide_tabs' => true
  150.                 );
  151.            
  152.             $type_meta_panel =  new PageLinesMetaPanel( $type_metapanel_settings );
  153.            
  154.            
  155.             $type_metatab_settings = array(
  156.                 'id'        => 'feature-type-metatab',
  157.                 'name'      => "Feature Setup Options",
  158.                 'icon'      => $this->icon,
  159.             );
  160.            
  161.             $type_meta_panel->register_tab( $type_metatab_settings, $type_meta_array );
  162.            
  163.            
  164.             /*
  165.                 Do Page/Post Options
  166.             */ 
  167.                 $page_metatab_array = array(
  168.                         'feature_items' => array(
  169.                             'version'   => 'pro',
  170.                             'type'      => 'text', 
  171.                             'size'      => 'small',                
  172.                             'title'     => 'Number of Feature Slides',
  173.                             'desc'      => 'Enter the max number of feature slides to show on this page. Note: If left blank, the number of posts selected under reading settings in the admin will be used.'
  174.                         ),
  175.                         'feature_set' => array(
  176.                             'version'   => 'pro',
  177.                             'type'      => 'select_taxonomy',
  178.                             'taxonomy_id'   => "feature-sets",             
  179.                             'title'     => 'Select Feature Set To Show',
  180.                             'desc'      => 'If you are using the feature section, select the feature set you would like to show on this page.'
  181.                         )
  182.                     );
  183.  
  184.                 $metatab_settings = array(
  185.                         'id' => 'feature_meta',
  186.                         'name' => "Feature Slider Section",
  187.                         'icon' => $this->icon
  188.                     );
  189.  
  190.                 register_metatab($metatab_settings, $page_metatab_array);
  191.  
  192.     }
  193.  
  194.     function section_head() {  
  195.  
  196.         global $pagelines_ID;
  197.  
  198.         // Get the features from post type
  199.         $f = $this->pagelines_features_set();  
  200.    
  201.         $feffect = (pagelines_option('feffect')) ? pagelines_option('feffect') : 'fade';
  202.         $timeout = (pagelines_option('timeout')) ? pagelines_option('timeout') : 0;
  203.         $speed   = (pagelines_option('fspeed')) ? pagelines_option('fspeed') : 1500;
  204.         $fsync   = (pagelines_option('fremovesync')) ? 0 : 1;
  205.         $autostop = ( has_filter('pagelines_feature_autostop') ) ? ', autostop: 1, autostopCount: ' . apply_filters( 'pagelines_feature_autostop', 0) : '';
  206.    
  207. ?><script type="text/javascript">
  208. /* <![CDATA[ */
  209.     var $j = jQuery.noConflict();
  210.     $j(document).ready(function () {
  211. <?php
  212.     //Feature Cycle Setup
  213.     printf( "\$j('#cycle').cycle({fx: '%s', sync: %d, timeout: %d, speed: %d, cleartype: true, cleartypeNoBg: true, pager: 'div#featurenav'%s});", $feffect, $fsync, $timeout, $speed, $autostop );
  214.    
  215.     $this->_js_feature_loop($f);
  216.  
  217.     if(pagelines('feature_playpause')):?>  
  218.         // Play Pause
  219.         $j('.playpause').click(function() {
  220.             if ($j('.playpause').hasClass('pause')) {
  221.                 $j('#cycle').cycle('pause');
  222.                 $j('.playpause').removeClass('pause').addClass('resume');
  223.             } else {
  224.                 $j('.playpause').removeClass('resume').addClass('pause');
  225.                 $j('#cycle').cycle('resume', true);    
  226.             }
  227.         });
  228.     <?php endif;?>
  229.    
  230. });
  231.  
  232. /* ]]> */
  233. </script>
  234. <?php }
  235.  
  236. function _js_feature_loop($fposts = array()){
  237.    
  238.     $count = 1;
  239.     $link_js = '';
  240.     $fmode = pagelines_option('feature_nav_type');
  241.    
  242.    
  243.         foreach($fposts as $fid => $f){
  244.    
  245.             $feature_name = (get_post_meta( $f->ID,'feature-name', true )) ? get_post_meta( $f->ID,'feature-name', true ): $f->post_name;
  246.             $feature_thumb = pagelines_option('feature-thumb', $f->ID);
  247.        
  248.             if($fmode == 'names' || $fmode == 'thumbs'){
  249.                 if($fmode == 'names')
  250.                     $replace_value = $feature_name;
  251.            
  252.                 elseif ($fmode == 'thumbs')
  253.                     $replace_value = sprintf("<span class='nav_thumb' style='background:#fff url(%s);'><span class='nav_overlay'>&nbsp;</span></span>", $feature_thumb);
  254.        
  255.                 $replace_js = sprintf('$j(this).html("%s");', $replace_value );
  256.             } else {
  257.                 $replace_js = '';
  258.             }
  259.            
  260.            
  261.             $link_title = sprintf('$j(this).attr("title", "%s");', $feature_name );
  262.            
  263.        
  264.             $link_js .= sprintf('if($j(this).html() == "%s") { %s %s }', $count, $link_title, $replace_js);
  265.        
  266.             $count++;
  267.         }
  268.    
  269.         printf('$j("div#featurenav").children("a").each(function() { %s });', $link_js);
  270.  
  271. }
  272.  
  273. function section_template() {    
  274.  
  275.     $f = $this->pagelines_features_set();
  276.  
  277.  
  278.     // $this->set set in pagelines_feature_set, better way to do this?
  279.     $this->draw_features($f, $this->set);
  280.  
  281. }
  282.  
  283. function pagelines_features_set(){
  284.    
  285.     global $post;
  286.     global $pagelines_ID;
  287.    
  288.     if( get_pagelines_meta('feature_set', $pagelines_ID) )
  289.         $this->set = get_post_meta($pagelines_ID, 'feature_set', true);
  290.     elseif (pagelines_option('feature_default_tax'))
  291.         $this->set = pagelines_option('feature_default_tax');
  292.     else
  293.         $this->set = null;
  294.    
  295.     $limit = (pagelines_option('feature_items', $pagelines_ID)) ? pagelines_option('feature_items', $pagelines_ID) : null;
  296.        
  297.     $source = (pagelines_option('feature_source') == 'posts') ? 'posts' : 'customtype';
  298.        
  299.     $f = $this->load_pagelines_features($this->set, $limit, $source);
  300.    
  301.     return $f; 
  302.        
  303. }
  304.  
  305. function load_pagelines_features( $set = null, $limit = null, $source = null){
  306.     $query = array();
  307.    
  308.     $query['orderby']   = 'ID';
  309.    
  310.     if($source == 'posts'){
  311.        
  312.         $query['post_type'] = 'post';
  313.        
  314.         if(pagelines_option('feature_category'))
  315.             $query['cat'] = pagelines_option('feature_category');
  316.  
  317.     } else {
  318.        
  319.         $query['post_type'] = 'feature';
  320.        
  321.         if(isset($set))
  322.             $query['feature-sets'] = $set;
  323.        
  324.     }
  325.    
  326.     if(isset($limit))
  327.         $query['showposts'] = $limit;
  328.  
  329.     $q = new WP_Query($query);
  330.    
  331.     if(is_array($q->posts))
  332.         return $q->posts;
  333.     else
  334.         return array();
  335. }
  336.  
  337. function draw_features($f, $class) {    
  338.    
  339.     global $post;
  340.     global $pagelines_layout;
  341.     $current_page_post = $post;
  342.        
  343. ?>     
  344.     <div id="feature_slider" class="<?php echo $class;?> fix">
  345.         <div id="feature-area">
  346.             <div id="cycle">
  347.             <?php
  348.                
  349.                 if(!empty($f)):
  350.                     foreach($f as $post) :
  351.                        
  352.                         // Setup For Std WP functions
  353.                         setup_postdata($post);
  354.                        
  355.                         // Get Feature Style
  356.                         $feature_style = (get_post_meta($post->ID, 'feature-style', true)) ? get_post_meta($post->ID, 'feature-style', true) : 'text-left';
  357.                        
  358.                         $flink_text = ( get_post_meta($post->ID, 'feature-link-text', true) ) ? __( get_post_meta($post->ID, 'feature-link-text', true) ) : __('More', 'pagelines');
  359.                    
  360.                         //Get the Thumbnail URL
  361.                         $feature_background_image = get_post_meta($post->ID, 'feature-background-image', true);
  362.                         $feature_design = (get_post_meta($post->ID, 'feature-design', true)) ? get_post_meta($post->ID, 'feature-design', true) : '';
  363.                
  364.                         ?>
  365.                         <div id="<?php echo 'feature_'.$post->ID;?>"  class="fcontainer <?php echo $feature_style.' '.$feature_design; ?> fix" >
  366.                             <div class="feature-wrap wcontent" <?php if($feature_background_image):?>style="background: url('<?php echo $feature_background_image;?>') no-repeat top center" <?php endif;?>>
  367.                                 <div class="feature-pad fix">
  368.                                     <?php pagelines_register_hook( 'pagelines_feature_before', $this->id ); // Hook ?>
  369.                                     <div class="fcontent <?php if(get_post_meta($post->ID, 'fcontent-bg', true)) echo get_post_meta($post->ID, 'fcontent-bg', true);?>">
  370.                                         <div class="dcol-pad fix">
  371.                                                 <?php pagelines_register_hook( 'pagelines_fcontent_before', $this->id ); // Hook ?>
  372.                                                 <div class="fheading">
  373.                                                     <h2 class="ftitle">
  374. <a class="ftitle" href='<?php the_permalink() ?>'>
  375. <?php the_title(); ?></a></h2>
  376.                                                 </div>
  377.                                                 <div class="ftext">
  378.                                                     <?php pagelines_register_hook( 'pagelines_feature_text_top', $this->id ); // Hook ?>
  379.                                                     <div class="fexcerpt">
  380.                                                     <?php
  381.                                                         if(pagelines_option('feature_source') == 'posts') echo apply_filters( 'pagelines_feature_output', get_the_excerpt() );
  382.                                                         else the_content();
  383.                                                     ?>
  384.                                                     </div>
  385.                                                     <?php if(get_post_meta($post->ID, 'feature-link-url', true)):?>
  386.                                                         <a class="pagelines-blink black-blink flink" href="<?php echo get_post_meta($post->ID, 'feature-link-url', true);?>">
  387.                                                             <span class="pagelines-blink-pad">
  388.                                                                 <span class="blink-arrow featurelink" ><?php echo __( $flink_text );?></span>
  389.                                                             </span>
  390.                                                         </a>
  391.                                                     <?php endif;?>
  392.                                                     <?php pagelines_register_hook( 'pagelines_feature_text_bottom', $this->id ); // Hook ?>
  393.                                                     <?php edit_post_link(__('<span>Edit</span>', 'pagelines'), '', '');?>
  394.                                                 </div>
  395.                                                 <?php pagelines_register_hook( 'pagelines_fcontent_after', $this->id ); // Hook ?>
  396.                                         </div>
  397.                                        
  398.                                     </div>
  399.                        
  400.                                     <div class="fmedia" style="">
  401.                                         <div class="dcol-pad">
  402.                                             <?php pagelines_register_hook( 'pagelines_feature_media_top', $this->id ); // Hook ?>
  403.                                             <?php if(get_post_meta($post->ID, 'feature-media-image', true)):?>
  404.                                                 <div class="media-frame">
  405.                                                     <img src="<?php echo get_post_meta( $post->ID, 'feature-media-image', true);?>" />
  406.                                                 </div>
  407.                                             <?php elseif(get_post_meta( $post->ID, 'feature-media', true)): ?>
  408.                                                 <?php echo do_shortcode(get_post_meta( $post->ID, 'feature-media', true)); ?>
  409.                                             <?php endif;?>
  410.                                            
  411.                                         </div>
  412.                                     </div>
  413.                                     <?php pagelines_register_hook( 'pagelines_feature_after', $this->id ); // Hook ?>
  414.                                     <div class="clear"></div>
  415.                                 </div>
  416.                             </div>
  417.                         </div>
  418.                     <?php endforeach; ?>
  419.                 <?php else: ?>
  420.                     <h4 style="padding: 50px; text-align: center"><?php _e('No feature posts matched this pages criteria', 'pagelines');?></h4>
  421.                 <?php endif;?>
  422.                 <?php $post = $current_page_post;?>
  423.        
  424.             </div>
  425.         </div>
  426.        
  427.         <div id="feature-footer" class="<?php e_pagelines('feature_nav_type', '');?> <?php  if( isset($this->the_feature_posts) && count($this->the_feature_posts) == 1) echo 'nonav';?> fix">
  428.             <div class="feature-footer-pad">
  429.                 <?php pagelines_register_hook( 'pagelines_feature_nav_before', $this->id ); // Hook ?>
  430.                 <?php if(pagelines('timeout') != 0 && pagelines('feature_playpause')):?><span class="playpause pause"><span>&nbsp;</span></span><?php endif;?>
  431.                 <div id="featurenav" class="fix">
  432.                    
  433.                 </div>
  434.                 <div class="clear"></div>
  435.             </div>
  436.         </div>
  437.        
  438.     </div>
  439.     <div class="clear"></div>
  440. <?php }
  441.  
  442.  
  443.  
  444.     function section_scripts() {  
  445.        
  446.         return array(
  447.                 'cycle' => array(
  448.                         'file' => $this->base_url . '/jquery.cycle.js',
  449.                         'dependancy' => array('jquery'),
  450.                         'location' => 'footer',
  451.                         'version' => '2.99'
  452.                     )  
  453.             );
  454.        
  455.     }
  456.  
  457.     function section_options($optionset = null, $location = null) {
  458.        
  459.         if($optionset == 'new' && $location == 'bottom'){
  460.             return array(
  461.                 'feature_settings' => array(
  462.                             'feature_nav_type' => array(
  463.                                 'default' => "thumbs",
  464.                                 'version'   => 'pro',
  465.                                 'type' => 'radio',
  466.                                 'selectvalues' => array(
  467.                                     'nonav' => 'No Navigation',
  468.                                     'dots' => 'Squares or Dots',
  469.                                     'names' => 'Feature Names',
  470.                                     'thumbs' => 'Feature Thumbs (50px by 30px)',                               
  471.                                     'numbers'=>'Numbers',
  472.                                 ),
  473.                                 'inputlabel' => 'Feature navigation type?',
  474.                                 'title' => 'Feature Navigation Mode',
  475.                                 'shortexp' => "Select the mode for your feature navigation",
  476.                                 'exp' => "Select from the three modes. Using feature names will use the names of the features, using the numbers will use incremental numbers, thumbnails will use feature thumbnails if provided.",
  477.                                 'docslink'      => 'http://www.pagelines.com/docs/feature-slider',
  478.                                 'vidtitle'      => 'View Feature Documentation'
  479.                             ),
  480.                             'timeout' => array(
  481.                                     'default' => 0,
  482.                                     'version'   => 'pro',
  483.                                     'type' => 'text_small',
  484.                                     'inputlabel' => 'Timeout (ms)',
  485.                                     'title' => 'Feature Viewing Time (Timeout)',
  486.                                     'shortexp' => 'The amount of time a feature is set before it transitions in milliseconds',
  487.                                     'exp' => 'Set this to 0 to only transition on manual navigation. Use milliseconds, for example 10000 equals 10 seconds of timeout.'
  488.                                 ),
  489.                             'fspeed' => array(
  490.                                     'default' => 1500,
  491.                                     'version'   => 'pro',
  492.                                     'type' => 'text_small',
  493.                                     'inputlabel' => 'Transition Speed (ms)',
  494.                                     'title' => 'Feature Transition Time (Timeout)',
  495.                                     'shortexp' => 'The time it takes for your features to transition in milliseconds',
  496.                                     'exp' => 'Use milliseconds, for example 1500 equals 1.5 seconds of transition time.'
  497.                                 ),
  498.                             'feffect' => array(
  499.                                     'default' => 'fade',
  500.                                     'version'   => 'pro',
  501.                                     'type' => 'select_same',
  502.                                     'selectvalues' => array('blindX','blindY','blindZ', 'cover','curtainX','curtainY','fade','fadeZoom','growX','growY','none','scrollUp','scrollDown','scrollLeft','scrollRight','scrollHorz','scrollVert','shuffle','slideX','slideY','toss','turnUp','turnDown','turnLeft','turnRight','uncover','wipe','zoom'),
  503.                                     'inputlabel' => 'Select Transition Effect',
  504.                                     'title' => 'Transition Effect',
  505.                                     'shortexp' => "How the features transition",
  506.                                     'exp' => "This controls the mode with which the features transition to one another."
  507.                                 ),
  508.                             'feature_playpause' => array(
  509.                                     'default' => false,
  510.                                     'version'   => 'pro',
  511.                                     'type' => 'check',
  512.                                     'inputlabel' => 'Show play pause button?',
  513.                                     'title' => 'Show Play/Pause Button (when timeout is greater than 0 (auto-transition))',
  514.                                     'shortexp' => "Show a play/pause button for auto-scrolling features",
  515.                                     'exp' => "Selecting this option will add a play/pause button for auto-scrolling features, that users can use to pause and watch a video, read a feature, etc.."
  516.                                 ),
  517.                             'feature_items' => array(
  518.                                     'default' => 10,
  519.                                     'version'   => 'pro',
  520.                                     'type' => 'text_small',
  521.                                     'inputlabel' => 'Number of Features To Show',
  522.                                     'title' => 'Number of Features',
  523.                                     'shortexp' => "Limit the number of features that are shown",
  524.                                     'exp' => "Use this option to limit the number of features shown."
  525.                                 ),
  526.                             'feature_source' => array(
  527.                                     'default' => 'featureposts',
  528.                                     'version'   => 'pro',
  529.                                     'type' => 'select',
  530.                                     'selectvalues' => array(
  531.                                         'featureposts'  => array("name" => 'Feature Posts (custom post type)'),
  532.                                         'posts'         => array("name" => 'Use Post Category'),
  533.                                     ),
  534.                                     'inputlabel' => 'Select source',
  535.                                     'title' => 'Feature Post Source',
  536.                                     'shortexp' => "Use feature posts or a post category",
  537.                                     'exp' => "By default the feature section will use feature posts, you can also set the source for features to a blog post category. Set the category ID in its option below. <br/> <strong>NOTE: If set to posts, excerpts will be used as content (control length through them). Also a new option panel will be added on post creation and editing pages.</strong>"
  538.                                 ),
  539.                             'feature_category' => array(
  540.                                     'default' => 1,
  541.                                     'version'   => 'pro',
  542.                                     'type' => 'select',
  543.                                     'selectvalues' => $this->get_cats(),
  544.                                     'title' => 'Post Category (Blog Post Mode Only)',
  545.                                     'shortexp' => "",
  546.                                     'exp' => "Select a category to use if sourcing features from blog posts"
  547.                                 ),
  548.                             'feature_default_tax' => array(
  549.                                     'default'       => 'default-features',
  550.                                     'version'       => 'pro',
  551.                                     'taxonomy_id'   => 'feature-sets',
  552.                                     'type'          => 'select_taxonomy',
  553.                                     'inputlabel'    => 'Select Posts/404 Feature-Set',
  554.                                     'title'         => 'Select Feature-Set for Posts & 404 Pages',
  555.                                     'shortexp'      => "Posts pages and similar pages (404) Will Use This set ID To Source Features",
  556.                                     'exp'           => "Posts pages and 404 pages in WordPress don't support meta data so you need to assign a set here. (If you want to use 'features' on these pages.)",
  557.                                 ),
  558.                             'feature_stage_height' => array(
  559.                                     'default'       => '330',
  560.                                     'version'       => 'pro',
  561.                                     'type'          => 'css_option',
  562.                                     'selectors'     => '#feature-area, .feature-wrap, #feature_slider .fmedia, #feature_slider .fcontent, #feature_slider .text-bottom .fmedia .dcol-pad, #feature_slider .text-bottom .feature-pad, #feature_slider .text-none .fmedia .dcol-pad',
  563.                                     'css_prop'      => 'height',
  564.                                     'css_units'     => 'px',
  565.                                     'inputlabel'    => 'Enter the height (In Pixels) of the Feature Stage Area',
  566.                                     'title'         => 'Feature Area Height',
  567.                                     'shortexp'      => "Use this feature to change the height of your feature area",
  568.                                     'exp'           => "To change the height of your feature area, just enter a number in pixels here.",
  569.                                 ),
  570.                             'fremovesync' => array(
  571.                                     'default' => false,
  572.                                     'type' => 'check',
  573.                                     'version'   => 'pro',
  574.                                     'inputlabel' => 'Remove Transition Syncing',
  575.                                     'title' => 'Remove Feature Transition Syncing',
  576.                                     'shortexp' => "Make features wait to move on until after the previous one has cleared the screen",
  577.                                     'exp' => "This controls whether features can move on to the screen while another is transitioning off. If removed features will have to leave the screen before the next can transition on to it."
  578.                                 )
  579.  
  580.                 )
  581.             );
  582.         }
  583.     }
  584.  
  585.  
  586. function get_cats() {
  587.    
  588.     $cats = get_categories();
  589.     foreach( $cats as $cat ) {
  590.         $categories[ $cat->cat_ID ] = array(
  591.             'name' => $cat->name
  592.         );
  593.     }
  594.     return $categories;
  595. }
  596.  
  597. // End of Section Class //
  598. }
  599.  
  600. function feature_column_display($column){
  601.     global $post;
  602.    
  603.     switch ($column){
  604.         case "feature-description":
  605.             the_excerpt();
  606.             break;
  607.         case "feature-media":
  608.             if(m_pagelines('feature-media', $post->ID)){
  609.                 em_pagelines('feature-media', $post->ID);
  610.             }elseif(m_pagelines('feature-media-image', $post->ID)){
  611.                 echo '<img src="'.m_pagelines('feature-media', $post->ID).'" style="max-width: 200px; max-height: 200px" />';
  612.             }elseif(m_pagelines('feature-background-image', $post->ID)){
  613.                 echo '<img src="'.m_pagelines('feature-background-image', $post->ID).'" style="max-width: 200px; max-height: 200px" />';
  614.             }
  615.             break;
  616.         case "feature-sets":
  617.             echo get_the_term_list($post->ID, 'feature-sets', '', ', ','');
  618.             break;
  619.     }
  620. }
  621.  
  622.        
  623. function pagelines_default_features(){
  624.    
  625.     $default_features = array_reverse(get_default_features());
  626.  
  627.    
  628.     foreach($default_features as $feature){
  629.         // Create post object
  630.         $default_post = array();
  631.         $default_post['post_title'] = $feature['title'];
  632.         $default_post['post_content'] = $feature['text'];
  633.         $default_post['post_type'] = 'feature';
  634.         $default_post['post_status'] = 'publish';
  635.        
  636.         $newPostID = wp_insert_post( $default_post );
  637.    
  638.         update_post_meta($newPostID, 'feature-thumb', $feature['thumb']);
  639.         update_post_meta($newPostID, 'feature-link-url', $feature['link']);
  640.         update_post_meta($newPostID, 'feature-style', $feature['style']);
  641.         update_post_meta($newPostID, 'feature-media', $feature['media']);
  642.         update_post_meta($newPostID, 'feature-background-image', $feature['background']);
  643.         update_post_meta($newPostID, 'feature-design', $feature['fcontent-design']);
  644.         wp_set_object_terms($newPostID, 'default-features', 'feature-sets');
  645.     }
  646. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement