Guest User

Untitled

a guest
Apr 21st, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.70 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Workplaces Early Ed
  4. */
  5. ?>
  6.  
  7. <?php get_header( "workplaces-earlyed" ); ?>
  8.     <?php
  9.     $content_css = '';
  10.     $sidebar_css = '';
  11.     $sidebar_exists = true;
  12.     $sidebar_left = '';
  13.     $double_sidebars = false;
  14.  
  15.     $sidebar_1 = get_post_meta( $post->ID, 'sbg_selected_sidebar_replacement', true );
  16.     $sidebar_2 = get_post_meta( $post->ID, 'sbg_selected_sidebar_2_replacement', true );
  17.  
  18.     if( $smof_data['pages_global_sidebar']  || ( class_exists( 'TribeEvents' ) &&  is_events_archive() ) ) {
  19.         if( $smof_data['pages_sidebar'] != 'None' ) {
  20.             $sidebar_1 = array( $smof_data['pages_sidebar'] );
  21.         } else {
  22.             $sidebar_1 = '';
  23.         }
  24.  
  25.         if( $smof_data['pages_sidebar_2'] != 'None' ) {
  26.             $sidebar_2 = array( $smof_data['pages_sidebar_2'] );
  27.         } else {
  28.             $sidebar_2 = '';
  29.         }
  30.     }
  31.  
  32.     if( ( is_array( $sidebar_1 ) && ( $sidebar_1[0] || $sidebar_1[0] === '0' ) ) && ( is_array( $sidebar_2 ) && ( $sidebar_2[0] || $sidebar_2[0] === '0' ) ) ) {
  33.         $double_sidebars = true;
  34.     }
  35.  
  36.     if( is_array( $sidebar_1 ) &&
  37.         ( $sidebar_1[0] || $sidebar_1[0] === '0' )
  38.     ) {
  39.         $sidebar_exists = true;
  40.     } else {
  41.         $sidebar_exists = false;
  42.     }
  43.  
  44.     if( ! $sidebar_exists ) {
  45.         $content_css = 'width:100%';
  46.         $sidebar_css = 'display:none';
  47.         $sidebar_exists = false;
  48.     } elseif(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'left') {
  49.         $content_css = 'float:right;';
  50.         $sidebar_css = 'float:left;';
  51.         $sidebar_left = 1;
  52.     } elseif(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'right') {
  53.         $content_css = 'float:left;';
  54.         $sidebar_css = 'float:right;';
  55.     } elseif(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'default' || ! metadata_exists( 'post', $post->ID, 'pyre_sidebar_position' )) {
  56.         if($smof_data['default_sidebar_pos'] == 'Left') {
  57.             $content_css = 'float:right;';
  58.             $sidebar_css = 'float:left;';
  59.             $sidebar_left = 1;
  60.         } elseif($smof_data['default_sidebar_pos'] == 'Right') {
  61.             $content_css = 'float:left;';
  62.             $sidebar_css = 'float:right;';
  63.             $sidebar_left = 2;
  64.         }
  65.     }
  66.  
  67.     if(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'right') {
  68.         $sidebar_left = 2;
  69.     }
  70.    
  71.     if( $smof_data['pages_global_sidebar']  || ( class_exists( 'TribeEvents' ) &&  is_events_archive() ) ) {
  72.         if( $smof_data['pages_sidebar'] != 'None' ) {
  73.             $sidebar_1 = $smof_data['pages_sidebar'];
  74.            
  75.             if( $smof_data['default_sidebar_pos'] == 'Right' ) {
  76.                 $content_css = 'float:left;';
  77.                 $sidebar_css = 'float:right;'; 
  78.                 $sidebar_left = 2;
  79.             } else {
  80.                 $content_css = 'float:right;';
  81.                 $sidebar_css = 'float:left;';
  82.                 $sidebar_left = 1;
  83.             }          
  84.         }
  85.  
  86.         if( $smof_data['pages_sidebar_2'] != 'None' ) {
  87.             $sidebar_2 = $smof_data['pages_sidebar_2'];
  88.         }
  89.        
  90.         if( $smof_data['pages_sidebar'] != 'None' && $smof_data['pages_sidebar_2'] != 'None' ) {
  91.             $double_sidebars = true;
  92.         }
  93.     } else {
  94.         $sidebar_1 = '0';
  95.         $sidebar_2 = '0';
  96.     }
  97.    
  98.     if($double_sidebars == true) {
  99.         $content_css = 'float:left;';
  100.         $sidebar_css = 'float:left;';
  101.         $sidebar_2_css = 'float:left;';
  102.     } else {
  103.         $sidebar_left = 1;
  104.     }  
  105.  
  106.     if(class_exists('Woocommerce')) {
  107.         if(is_cart() || is_checkout() || is_account_page() || (get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id')))) {
  108.             $content_css = 'width:100%';
  109.             $sidebar_css = 'display:none';
  110.             $sidebar_exists = false;
  111.         }
  112.     }
  113.     ?>
  114.     <div id="content" style="<?php echo $content_css; ?>">
  115.         <?php
  116.         while( have_posts() ): the_post();
  117.         ?>
  118.         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  119.             <?php echo avada_render_rich_snippets_for_pages(); ?>
  120.             <?php if( ! post_password_required($post->ID) ): // 1 ?>
  121.             <?php global $smof_data; if(!$smof_data['featured_images_pages'] ): // 2 ?>
  122.             <?php
  123.             if( avada_number_of_featured_images() > 0 || get_post_meta( $post->ID, 'pyre_video', true ) ): // 3
  124.             ?>
  125.             <div class="fusion-flexslider flexslider post-slideshow">
  126.                 <ul class="slides">
  127.                     <?php if(get_post_meta($post->ID, 'pyre_video', true)): ?>
  128.                     <li>
  129.                         <div class="full-video">
  130.                             <?php echo get_post_meta($post->ID, 'pyre_video', true); ?>
  131.                         </div>
  132.                     </li>
  133.                     <?php endif; ?>
  134.                     <?php if( has_post_thumbnail() && get_post_meta( $post->ID, 'pyre_show_first_featured_image', true ) != 'yes' ): ?>
  135.                     <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
  136.                     <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
  137.                     <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?>
  138.                     <li>
  139.                         <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>" data-title="<?php echo get_post_field('post_title', get_post_thumbnail_id()); ?>" data-caption="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" /></a>
  140.                     </li>
  141.                     <?php endif; ?>
  142.                     <?php
  143.                     $i = 2;
  144.                     while($i <= $smof_data['posts_slideshow_number']):
  145.                     $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'page');
  146.                     if($attachment_new_id):
  147.                     ?>
  148.                     <?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?>
  149.                     <?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?>
  150.                     <?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?>
  151.                     <li>
  152.                         <a href="<?php echo $full_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo get_post_field('post_excerpt', $attachment_new_id); ?>" data-title="<?php echo get_post_field( 'post_title', $attachment_new_id ); ?>" data-caption="<?php echo get_post_field('post_excerpt', $attachment_new_id ); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta($attachment_new_id, '_wp_attachment_image_alt', true); ?>" /></a>
  153.                     </li>
  154.                     <?php endif; $i++; endwhile; ?>
  155.                 </ul>
  156.             </div>
  157.             <?php endif; // 3 ?>
  158.             <?php endif; // 2 ?>
  159.             <?php endif; // 1 password check ?>
  160.             <div class="post-content">
  161.                 <?php the_content(); ?>
  162.                 <?php avada_link_pages(); ?>
  163.             </div>
  164.             <?php if( ! post_password_required($post->ID) ): ?>
  165.             <?php if(class_exists('Woocommerce')): ?>
  166.             <?php
  167.             $woo_thanks_page_id = get_option('woocommerce_thanks_page_id');
  168.             if( ! get_option('woocommerce_thanks_page_id') ) {
  169.                 $is_woo_thanks_page = false;
  170.             } else {
  171.                 $is_woo_thanks_page = is_page( get_option( 'woocommerce_thanks_page_id' ) );
  172.             }
  173.             ?>
  174.             <?php if($smof_data['comments_pages'] && !is_cart() && !is_checkout() && !is_account_page() && ! $is_woo_thanks_page ): ?>
  175.                 <?php
  176.                 wp_reset_query();
  177.                 comments_template();
  178.                 ?>
  179.             <?php endif; ?>
  180.             <?php else: ?>
  181.             <?php if($smof_data['comments_pages']): ?>
  182.                 <?php
  183.                 wp_reset_query();
  184.                 comments_template();
  185.                 ?>
  186.             <?php endif; ?>
  187.             <?php endif; ?>
  188.             <?php endif; // password check ?>
  189.         </div>
  190.         <?php endwhile; ?>
  191.         <?php wp_reset_query(); ?>
  192.     </div>
  193.     <?php if( $sidebar_exists == true ): ?>
  194.     <div id="sidebar" class="sidebar" style="<?php echo $sidebar_css; ?>">
  195.         <?php
  196.         if($sidebar_left == 1) {
  197.             generated_dynamic_sidebar($sidebar_1);
  198.         }
  199.         if($sidebar_left == 2) {
  200.             generated_dynamic_sidebar_2($sidebar_2);
  201.         }
  202.         ?>
  203.     </div>
  204.     <?php if( $double_sidebars == true ): ?>
  205.     <div id="sidebar-2" class="sidebar" style="<?php echo $sidebar_2_css; ?>">
  206.         <?php
  207.         if($sidebar_left == 1) {
  208.             generated_dynamic_sidebar_2($sidebar_2);
  209.         }
  210.         if($sidebar_left == 2) {
  211.             generated_dynamic_sidebar($sidebar_1);
  212.         }
  213.         ?>
  214.     </div>
  215.     <?php endif; ?>
  216.     <?php endif; ?>
  217. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment