Advertisement
Uranbold

feature-area.php

May 30th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. <?php
  2.  
  3. if (is_page() || (waves_woocommerce() && get_post_type() == 'product' && !is_singular('product'))) {
  4. $pid = $post->ID;
  5. if (waves_woocommerce() && get_post_type() == 'product') {
  6. $pid = woocommerce_get_page_id('shop');
  7. }
  8. $feature = '';
  9. $type = get_post_meta($pid, 'feature_area', true);
  10. if ($type == "slider") {
  11. $revSl = get_post_meta($pid, 'slider', true);
  12. $echoSlider = true;
  13. $echoSlider = waves_rev_check($revSl, $echoSlider);
  14. if ($echoSlider) {
  15. $feature = do_shortcode($revSl);
  16. } else {
  17. $feature = esc_html__('Select Slider', 'ninetysix');
  18. }
  19. } elseif ($type == "embed") {
  20. $feature = do_shortcode(htmlspecialchars_decode(get_post_meta($pid, 'embed', true)));
  21. } elseif ($type == "image") {
  22. $img = waves_image('full', true);
  23. $get_description = get_post(get_post_thumbnail_id())->post_excerpt;
  24. if (!empty($img['url'])) {
  25. $feature .= '<div class="feature-area">';
  26. $feature .= '<div class="featured-img" style="background-image: url(' . esc_url($img['url']) . ')"></div>';
  27. if(!empty($get_description)){//If description is not empty show the div
  28. echo '<div class="featured_caption">' . $get_description . '</div>';
  29. }
  30. $feature .= '</div>';
  31. }
  32. } elseif ($type != "none") {
  33. $feature .= '<div class="feature-title">';
  34. if ((waves_woocommerce() && get_post_type() == 'product')) {
  35. $feature .= '<h1>';
  36. ob_start();
  37. woocommerce_page_title();
  38. $feature .= ob_get_clean();
  39. $feature .= '</h1>';
  40. } else {
  41. $feature .= '<h1>' . get_the_title() . '</h1>';
  42. }
  43. $feature .= '</div>';
  44. }
  45. if ($feature && ($type == "slider")) {
  46. echo '<div class="feature-area">';
  47. echo ($feature);
  48. echo '</div>';
  49. } elseif ($feature) {
  50. echo '<div class="feature-area">';
  51. echo '<div class="container">';
  52. echo ($feature);
  53. echo '</div>';
  54. echo '</div>';
  55. }
  56. } elseif (is_singular('post')) {
  57. $layout = get_post_meta($post->ID, 'single_layout', true);
  58. if (empty($layout)) {
  59. $layout = waves_option('single_layout', 'with-sidebar');
  60. }
  61. $waves_options['single_layout'] = $layout;
  62. waves_set_options($waves_options);
  63. if ($waves_options['single_layout'] == 'full-width') {
  64. $img = waves_image('full', true);
  65. $get_description = get_post(get_post_thumbnail_id())->post_excerpt;
  66. if (!empty($img['url'])) {
  67. echo '<div class="feature-area">';
  68. echo '<div class="featured-img" style="background-image: url(' . esc_url($img['url']) . ')"></div>';
  69. if(!empty($get_description)){//If description is not empty show the div
  70. echo '<div class="featured_caption">' . $get_description . '</div>';
  71. }
  72. echo '</div>';
  73. }
  74. }
  75. } elseif (is_singular('portfolio')) {
  76. $feature = '';
  77. $type = get_post_meta($post->ID, 'feature_area', true);
  78. $layout = get_post_meta($post->ID, 'single_layout', true);
  79. if (empty($layout)) {
  80. $layout = waves_option('portfolio_layout', 'with-sidebar');
  81. }
  82. $waves_options['single_layout'] = $layout;
  83.  
  84. waves_set_options($waves_options);
  85. if ($type == 'slider') {
  86. echo do_shortcode(get_post_meta($post->ID, 'slider', true));
  87. } elseif ($type == 'images') {
  88. $c_start = '<div class="container">';
  89. $c_end = '</div>';
  90. $img_size = 'waves_featured_img';
  91. if ($waves_options['single_layout'] == 'full-width') {
  92. $c_start = $c_end = '';
  93. $img_size = 'full';
  94. }
  95. $imagess = get_post_meta($post->ID, 'images', true);
  96. if ($imagess) {
  97. $images = explode(',', $imagess);
  98. wp_enqueue_script('waves-owl-carousel');
  99. $feature .= '<div class="feature-area">' . $c_start;
  100. $feature .= '<div class="tw-carousel-container image-slide-container">';
  101. $feature .= '<div class="tw-carousel">';
  102. foreach ($images as $image) {
  103. $img = wp_get_attachment_image_src($image, 'full');
  104. $desc = get_post_field('post_excerpt', $image);
  105. $feature .= '<div class="tw-owl-item">';
  106. $feature .= '<img src="' . esc_url($img[0]) . '"' . ($desc ? ' title="' . $desc . '"' : '') . ' />';
  107. $feature .= '</div>';
  108. }
  109. $feature .= '</div>';
  110. $feature .= '</div>';
  111. $feature .= $c_end . '</div>';
  112. echo balanceTags($feature);
  113. }
  114. } elseif ($type != 'none') {
  115. $c_start = '<div class="container">';
  116. $c_end = '</div>';
  117. $img_size = 'waves_featured_img';
  118. $get_description = get_post(get_post_thumbnail_id())->post_excerpt;
  119. if ($waves_options['single_layout'] == 'full-width') {
  120. $c_start = $c_end = '';
  121. $img_size = 'full';
  122. }
  123. $img = waves_image('full', true);
  124. if (!empty($img['url'])) {
  125. echo '<div class="feature-area">' . $c_start;
  126. echo '<div class="featured-img" style="background-image: url(' . esc_url($img['url']) . ')"></div>';
  127. if(!empty($get_description)){//If description is not empty show the div
  128. echo '<div class="featured_caption">' . $get_description . '</div>';
  129. }
  130. echo ($c_end . '</div>');
  131. }
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement