Advertisement
cyberdev

Untitled

Jul 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.60 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template part for displaying single post "Don't Miss" section.
  4.  *
  5.  * @license For the full license information, please view the Licensing folder
  6.  * that was distributed with this source code.
  7.  *
  8.  * @package Bimber_Theme 4.10
  9.  */
  10.  
  11. // Prevent direct script access.
  12. if ( ! defined( 'ABSPATH' ) ) {
  13.     die( 'No direct script access allowed' );
  14. }
  15. ?>
  16. <?php
  17. $bimber_query = get_transient( 'bimber_dont_miss_query' );
  18.  
  19. if ( true === $bimber_query ) {
  20.     $bimber_query_args = array(
  21.         'posts_per_page'      => bimber_get_dont_miss_posts_limit(),
  22.         'time_range'          => 'month',
  23.         'ignore_sticky_posts' => true,
  24.     );
  25.  
  26.     // Exclude the current post.
  27.     if ( is_single() ) {
  28.         $bimber_query_args['post__not_in'] = array( get_the_ID() );
  29.     }
  30.  
  31.     // Short circuit.
  32.     if ( has_filter( 'bimber_pre_dont_miss_query_args', false ) ) {
  33.         $bimber_query_args = apply_filters( 'bimber_pre_dont_miss_query_args', $bimber_query_args );
  34.     } else {
  35.         $bimber_query_args = bimber_get_most_viewed_query_args( $bimber_query_args, 'dont_miss' );
  36.     }
  37.  
  38.     $bimber_query = new WP_Query( $bimber_query_args );
  39.  
  40.     set_transient( 'bimber_dont_miss_query', $bimber_query );
  41. }
  42. ?>
  43.  
  44. <aside class="g1-dont-miss">
  45.     <h2 class="g1-beta g1-beta-2nd"><?php esc_html_e( 'Don\'t Miss', 'bimber' ); ?></h2>
  46.  
  47.     <?php if ( $bimber_query->have_posts() ) : ?>
  48.  
  49.         <?php
  50.         $bimber_dont_miss_elements = bimber_conver_string_to_bool_array(
  51.             bimber_get_theme_option( 'post', 'dont_miss_hide_elements' ),
  52.             array(
  53.                 'featured_media' => true,
  54.                 'avatar'         => true,
  55.                 'categories'     => true,
  56.                 'summary'        => true,
  57.                 'author'         => true,
  58.                 'date'           => true,
  59.                 'shares'         => true,
  60.                 'views'          => true,
  61.                 'comments_link'  => true,
  62.             )
  63.         );
  64.  
  65.         $bimber_settings = apply_filters( 'bimber_entry_dont_miss_settings', array(
  66.             'elements' => $bimber_dont_miss_elements,
  67.         ) );
  68.  
  69.         bimber_set_template_part_data( $bimber_settings );
  70.         ?>
  71.         <div class="g1-collection g1-collection-columns-2">
  72.             <div class="g1-collection-viewport">
  73.                 <ul class="g1-collection-items">
  74.                     <?php while ( $bimber_query->have_posts() ) : $bimber_query->the_post(); ?>
  75.  
  76.                         <li class="g1-collection-item g1-collection-item-1of3">
  77.                             <?php get_template_part( 'template-parts/content-grid-standard', get_post_format() ); ?>
  78.                         </li>
  79.  
  80.                     <?php endwhile; ?>
  81.                 </ul>
  82.             </div>
  83.         </div>
  84.  
  85.         <?php bimber_reset_template_part_data(); ?>
  86.         <?php wp_reset_postdata(); ?>
  87.  
  88.     <?php else : ?>
  89.         <?php get_template_part( 'template-parts/most-viewed-empty-list-info' ); ?>
  90.     <?php endif; ?>
  91.  
  92. </aside>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement