Advertisement
rdusnr

Untitled

Jul 11th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.60 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for List Blog entry
  4. *
  5. * @package WordPress
  6. * @subpackage Kleo
  7. * @since Kleo 1.0
  8. */
  9. ?>
  10.  
  11. <article id="post-<?php the_ID(); ?>" <?php post_class(array("post-item")); ?>>
  12. <div class="row post-content animated animate-when-almost-visible el-appear">
  13.  
  14. <div class="col-sm-3">
  15. <?php
  16. global $kleo_config;
  17. $kleo_post_format = get_post_format();
  18.  
  19. /* For portfolio post type */
  20. if ( get_post_type() == 'portfolio' ) {
  21. if ( get_cfield( 'media_type' ) && get_cfield( 'media_type' ) != '' ) {
  22. $media_type = get_cfield( 'media_type' );
  23. switch ( $media_type ) {
  24. case 'slider':
  25. $kleo_post_format = 'gallery';
  26. break;
  27.  
  28. case 'video':
  29. case 'hosted_video':
  30. $kleo_post_format = 'video';
  31. break;
  32. }
  33. }
  34. }
  35.  
  36. switch ( $kleo_post_format ) {
  37.  
  38. case 'video':
  39.  
  40. //oEmbed video
  41. $video = get_cfield( 'embed' );
  42. // video bg self hosted
  43. $bg_video_args = array();
  44. $k_video = '';
  45.  
  46. if (get_cfield( 'video_mp4' ) ) {
  47. $bg_video_args['mp4'] = get_cfield( 'video_mp4' );
  48. }
  49. if (get_cfield( 'video_ogv' ) ) {
  50. $bg_video_args['ogv'] = get_cfield( 'video_ogv' );
  51. }
  52. if (get_cfield( 'video_webm' ) ) {
  53. $bg_video_args['webm'] = get_cfield( 'video_webm' );
  54. }
  55.  
  56. if ( !empty( $bg_video_args ) ) {
  57. $attr_strings = array(
  58. 'preload="none"'
  59. );
  60.  
  61. if (get_cfield( 'video_poster' ) ) {
  62. $attr_strings[] = 'poster="' . get_cfield( 'video_poster' ) . '"';
  63. }
  64.  
  65. $k_video .= '<div class="kleo-video-wrap"><video ' . join( ' ', $attr_strings ) . ' controls="controls" class="kleo-video" style="width: 100%; height: 100%;">';
  66.  
  67. $source = '<source type="%s" src="%s" />';
  68. foreach ( $bg_video_args as $video_type => $video_src ) {
  69. $video_type = wp_check_filetype( $video_src, wp_get_mime_types() );
  70. $k_video .= sprintf( $source, $video_type['type'], esc_url( $video_src ) );
  71. }
  72.  
  73. $k_video .= '</video></div>';
  74.  
  75. echo $k_video;
  76. }
  77. // oEmbed
  78. elseif ( !empty( $video ) ) {
  79. global $wp_embed;
  80. echo apply_filters( 'kleo_oembed_video', $video );
  81. }
  82.  
  83. break;
  84.  
  85. case 'audio':
  86.  
  87. $audio = get_cfield('audio');
  88. if (!empty($audio)) { ?>
  89. <div class="post-audio">
  90. <audio preload="none" class="kleo-audio" id="audio_<?php the_id();?>" style="width:100%;" src="<?php echo $audio; ?>"></audio>
  91. </div>
  92. <?php
  93. }
  94. break;
  95.  
  96. case 'gallery':
  97.  
  98. $slides = get_cfield('slider');
  99. echo '<div class="kleo-banner-slider">'
  100. .'<div class="kleo-banner-items modal-gallery">';
  101. if ( $slides ) {
  102. foreach( $slides as $slide ) {
  103. if ( $slide ) {
  104. $image = aq_resize( $slide, $kleo_config['post_gallery_img_width'], $kleo_config['post_gallery_img_height'], true, true, true );
  105. //small hack for non-hosted images
  106. if (! $image ) {
  107. $image = $slide;
  108. }
  109. echo '<article>
  110. <a href="'. $slide .'" data-rel="modalPhoto[inner-gallery]">
  111. <img src="'.$image.'" alt="'. get_the_title() .'">'
  112. . kleo_get_img_overlay()
  113. . '</a>
  114. </article>';
  115. }
  116. }
  117. }
  118.  
  119. echo '</div>'
  120. . '<a href="#" class="kleo-banner-prev"><i class="icon-angle-left"></i></a>'
  121. . '<a href="#" class="kleo-banner-next"><i class="icon-angle-right"></i></a>'
  122. . '<div class="kleo-banner-features-pager carousel-pager"></div>'
  123. .'</div>';
  124.  
  125. break;
  126.  
  127.  
  128. case 'aside':
  129. echo '<div class="post-format-icon"><i class="icon icon-doc"></i></div>';
  130. break;
  131.  
  132. case 'link':
  133. echo '<div class="post-format-icon"><i class="icon icon-link"></i></div>';
  134. break;
  135.  
  136. case 'quote':
  137. echo '<div class="post-format-icon"><i class="icon icon-quote-right"></i></div>';
  138. break;
  139.  
  140. case 'image':
  141. default:
  142. if ( kleo_get_post_thumbnail_url() != '' ) {
  143. echo '<div class="post-image">';
  144.  
  145. //check for custom image sizes
  146. if ( sq_option( 'blog_custom_img', 0 ) == 1 ) {
  147. $image = kleo_get_post_thumbnail( null, 'kleo-post-small-thumb' );
  148. $image_content = $image;
  149. } else {
  150. $img_url = kleo_get_post_thumbnail_url();
  151. $image = aq_resize( $img_url, $kleo_config['post_gallery_img_width'], null, true, true, true );
  152. if( ! $image ) {
  153. $image = $img_url;
  154. }
  155. $image_content = '<img src="' . $image . '" alt="'. get_the_title() .'">';
  156. }
  157.  
  158. echo '<a href="'. get_permalink() .'" class="element-wrap">'
  159. . $image_content
  160. . kleo_get_img_overlay()
  161. . '</a>';
  162.  
  163. echo '</div><!--end post-image-->';
  164. } else {
  165. $post_icon = $kleo_post_format == 'image' ? 'picture' : 'doc';
  166. echo '<div class="post-format-icon"><i class="icon icon-' . $post_icon . '"></i></div>';
  167. }
  168.  
  169. break;
  170.  
  171. }
  172. ?>
  173. </div>
  174. <div class="col-sm-9">
  175.  
  176. <?php if ( ! in_array( $kleo_post_format, array('status', 'quote', 'link') ) ): ?>
  177. <div class="post-header">
  178.  
  179. <h3 class="post-title entry-title"><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
  180.  
  181. <span class="post-meta">
  182. <?php kleo_entry_meta();?>
  183. </span>
  184.  
  185. </div><!--end post-header-->
  186. <?php endif; ?>
  187.  
  188. <?php if (kleo_excerpt() != '<p></p>') : ?>
  189. <div class="post-info">
  190.  
  191. <div class="entry-summary">
  192. <?php if ( ! in_array( $kleo_post_format, array('status', 'quote', 'link') ) ): ?>
  193. <?php if( is_archive() ) {
  194. echo get_the_content();
  195. } else {
  196. echo kleo_excerpt();
  197. } ?>
  198. <?php else : ?>
  199. <?php the_content();?>
  200. <?php endif;?>
  201. </div><!-- .entry-summary -->
  202.  
  203. </div><!--end post-info-->
  204. <?php endif; ?>
  205.  
  206. <div class="post-footer">
  207. <small>
  208. <?php do_action('kleo_post_footer');?>
  209.  
  210. <?php if ( $kleo_post_format == 'link' ): ?>
  211. <a href="<?php echo sq_get_url_link( get_the_content(), get_permalink() );?>" target="_blank">
  212. <span class="muted pull-right"><?php esc_html_e( "Read more","kleo_framework" );?></span>
  213. </a>
  214. <?php else: ?>
  215. <a href="<?php the_permalink();?>"><span class="muted pull-right">
  216. <?php esc_html_e( "Read more","kleo_framework" );?></span>
  217. </a>
  218. <?php endif; ?>
  219. </small>
  220. </div><!--end post-footer-->
  221. </div>
  222.  
  223.  
  224. </div><!--end post-content-->
  225. </article>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement