Advertisement
Guest User

Untitled

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