Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. <?php
  2. /**
  3. * The default template for displaying content
  4. *
  5. * Used for single posts display
  6. *
  7. * @package WordPress
  8. * @subpackage Seeko
  9. * @since 1.0
  10. */
  11.  
  12. global $post;
  13.  
  14. $classes = [ 'post-card' ];
  15. $post_thumbnail = get_the_post_thumbnail( null, 'post-card' );
  16. $has_thumbnail = $post_thumbnail == '' ? false : true;
  17.  
  18. $post_format = get_post_format();
  19.  
  20. if ( ! $has_thumbnail ) {
  21. $classes['entire'] = 'entire-post-card';
  22. } elseif ( 'image' == $post_format ) {
  23. $classes['entire'] = 'entire-post-card';
  24. $classes['format'] = $post_format . '-post-card';
  25. }
  26.  
  27. /* Gallery format */
  28. $gallery_images = false;
  29. if ( $post_format == 'gallery' ) {
  30.  
  31. $gallery_images = svq_get_gallery_images( null, [ 'format' => 'id' ] );
  32. if ( ! $gallery_images === false && ! empty( $gallery_images ) ) {
  33. $classes['entire'] = 'entire-post-card';
  34. $classes['format'] = $post_format . '-post-card';
  35. } else {
  36. $post_format = 'standard';
  37. }
  38. }
  39.  
  40. if ( ( 'video' === $post_format && $has_thumbnail ) || 'quote' === $post_format ) {
  41. $classes['entire'] = 'entire-post-card';
  42. $classes['format'] = $post_format . '-post-card';
  43. }
  44.  
  45. ?>
  46.  
  47. <article id="post-<?php the_ID(); ?>" <?php post_class( join( ' ', $classes ) ); ?>>
  48.  
  49. <?php if ( $post_format == 'gallery' ) : ?>
  50.  
  51. <?php if ( $gallery_images ) :
  52. wp_enqueue_script( 'slick' );
  53. ?>
  54. <section class="svq-slick svq-slick-inner-arrows"
  55. data-arrows="true" data-infinite="true" data-show-slides="1" data-scroll-slides="1"
  56. data-fade="true"
  57. data-ease="linear" data-speed="500">
  58.  
  59. <?php foreach ( $gallery_images as $gallery_image ): ?>
  60. <div>
  61. <figure class="img-dynamic aspect-ratio ratio-16-9 img-round post-thumbnail">
  62. <div class="img-card">
  63. <?php echo wp_get_attachment_image( $gallery_image, 'post-card' ); ?>
  64. </div>
  65. </figure>
  66. </div>
  67. <?php endforeach; ?>
  68. </section>
  69.  
  70. <?php endif; ?>
  71.  
  72. <?php elseif ( $post_format == 'quote' ) : ?>
  73.  
  74. <?php elseif ( $has_thumbnail ) : ?>
  75.  
  76. <figure class="post-thumbnail img-dynamic aspect-ratio ratio-16-9 img-round">
  77. <a class="img-card" href="<?php the_permalink(); ?>">
  78. <?php
  79. // This variable has been safely escaped by get_the_post_thumbnail function
  80. echo $post_thumbnail; // WPCS: XSS OK.
  81. ?>
  82. </a>
  83. <noscript>
  84. <a class="img-card" href="<?php the_permalink(); ?>">
  85. <span style="background-image:url(<?php the_post_thumbnail_url( 'post-card' ); ?>);"></span>
  86. </a>
  87. </noscript>
  88. </figure>
  89.  
  90. <?php endif; ?>
  91.  
  92. <div class="entry-wrapper">
  93. <div class="entry-all">
  94.  
  95. <?php if ( $post_format == 'quote' ) : ?>
  96.  
  97. <div class="entry-top"></div>
  98. <div class="entry-middle">
  99. <a class="img-card-hover" href="<?php the_permalink(); ?>"></a>
  100. <div class="entry-content">
  101. <?php echo svq_get_content_quote( apply_filters( 'the_content', $post->post_content ) ); ?>
  102. </div>
  103. </div>
  104.  
  105. <?php else : ?>
  106.  
  107. <div class="entry-top">
  108. <?php svq_the_meta_category( ' ' ); ?>
  109. </div>
  110.  
  111. <div class="entry-middle">
  112. <a class="img-card-hover" href="<?php the_permalink(); ?>"></a>
  113. <header class="entry-header">
  114.  
  115. <?php
  116. the_title(
  117. sprintf( '<h3 class="entry-title h4"><a href="%s">', get_permalink() ),
  118. '</a></h3>'
  119. );
  120. ?>
  121. </header>
  122. <div class="entry-content">
  123. <a href="<?php the_permalink(); ?>"></a>
  124. <div class="meta-excerpt">
  125. <?php the_excerpt(); ?>
  126. </div>
  127. </div>
  128. </div>
  129.  
  130. <?php endif; ?>
  131.  
  132. <?php if ( svq_option( 'blog_author_meta_archive', 1 ) ) : ?>
  133. <footer class="entry-footer">
  134. <a class="meta-author" href="<?php echo esc_url( svq_get_author_link() ); ?>">
  135. <span class="avatar avatar-square-xs<?php if ( function_exists( 'svq_get_member_online_class' ) ) {
  136. echo svq_get_member_online_class( get_the_author_meta( 'ID' ) );
  137. } ?>">
  138. <?php echo get_avatar( get_the_author_meta( 'ID' ), 30, '', '', [ 'class' => 'img-progressive progressive--not-loaded' ] ); ?>
  139. </span>
  140.  
  141. <span class="author-and-date">
  142. <span class="author-name"><?php the_author(); ?></span>
  143. <time datetime="<?php echo get_the_date( 'Y-m-d H:i' ); ?>"
  144. class="entry-date"><?php echo get_the_date(); ?></time>
  145. </span>
  146. </a>
  147. </footer>
  148. <?php endif; ?>
  149.  
  150. </div>
  151. </div>
  152.  
  153. </article><!-- #post-## -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement