Advertisement
ikamal7

featured_event_slider.php

Nov 4th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <?php
  2.     if(dom767_get_option('show_featured_event')==true):
  3.     $args = array('post_type' => 'ajde_events','meta_query' => array( array('key' => '_featured', 'value' => 'yes', )),);
  4.     $loop = new WP_Query( $args );
  5.     $arr_postIds = array();
  6.     while ( $loop->have_posts() ) : $loop->the_post();
  7.     $arr_postIds[$post->ID]['post_id'] = $post->ID;
  8.     $arr_postIds[$post->ID]['end_date'] = gmdate('Y-m-d', get_post_meta( $post->ID, 'evcal_erow', true ));
  9.     endwhile;  
  10.    
  11.     if(isset($arr_postIds) && is_array($arr_postIds) && count($arr_postIds) > 0)
  12.     {
  13.         $columns = array_column($arr_postIds, 'end_date');
  14.         array_multisort($columns, SORT_ASC, $arr_postIds);  
  15.     }
  16.     //while ( $loop->have_posts() ) : $loop->the_post();
  17.     foreach ($arr_postIds as $arr_postId) :
  18.         $post->ID = $arr_postId['post_id'];
  19. ?>
  20. <?php
  21.     $end_date = gmdate('Y-m-d', get_post_meta( $post->ID, 'evcal_erow', true ));
  22.  
  23.     if($end_date >= date('Y-m-d')):
  24. ?>
  25.     <div class="event_banner_container">
  26.         <div class="fetured-slider has-arrows">
  27.             <div class="flex_container">
  28.                 <div class="banner-row">
  29.                     <?php get_template_part('templates/event-post/event_slider'); ?>
  30.                     <div class="banner-end-row">
  31.                         <!-- Event Top Banner Information in Templates-event-post-event_banner_cont.php -->
  32.                         <?php get_template_part('templates/event-post/event_banner_cont'); ?>
  33.                     </div>
  34.                 </div>
  35.             </div>
  36.         </div>
  37.     </div>
  38.     <?php endif; ?>
  39. <?php //endforeach;
  40.         endforeach;
  41.     wp_reset_postdata();
  42.     endif;
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement