ikamal7

event_slider.php

Nov 4th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.09 KB | None | 0 0
  1. <?php
  2. $post_id = $post->ID;
  3. $cover_img  = get_post_meta($post_id, 'event_image_cover', true );
  4.     if(!empty($cover_img)){
  5.         echo '<div class="banner_event_box_image" style="background-image:url('.$cover_img.')"></div>';
  6.     }
  7.     else{
  8.         $src = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'medium' );
  9.         echo '<div class="banner_event_box_image" style="background-image:url('.$src[0].')"></div>';
  10.     }
  11. ?>
  12. <div class="banner-featured-tticon">
  13.     <div class="banner-heading-header">
  14.         <h3><span><i class="fas fa-star"></i></span>Featured Event</h3>
  15.         <h5><a href="<?php echo get_the_permalink($post->ID);?>"><?php echo get_the_title($post->ID);?></a></h5>
  16.     </div>
  17.     <div class="banner-heading-container">
  18.         <?php
  19.         $terms_organize = get_the_terms( $post->ID , 'event_organizer' );
  20.         if ( $terms_organize != null ){
  21.             foreach( $terms_organize as $term_organize )
  22.             {
  23.                 echo '<p><i class="fas fa-street-view"></i><span>&#8230;</span> '. $term_organize->name . '</p>';
  24.             }
  25.         }
  26.         ?>
  27.         <?php
  28.             $locations = get_the_terms($post->ID, 'event_location');
  29.             if (!empty($locations)) {
  30.             foreach ($locations as $location) {
  31.             echo '<p><i class="fas fa-map-marker-alt"></i><span>&#8230;</span> '. $location->name .'</span>';
  32.             }
  33.         }
  34.         ?>
  35.         <?php
  36.             //Event Categories
  37.             $terms = get_the_terms( $post->ID , 'event_type' );
  38.             $termcount = count($terms);
  39.             $termcount = $termcount -1;
  40.             if ( $terms != null ){
  41.                 foreach( $terms as $term ) {
  42.                     if($count == 0)
  43.                     {
  44.                         $termcount = $termcount > 0 ? ' +' . $termcount : '';
  45.                     }
  46.                     echo '<p><i class="fas fa-folder"></i><span>&#8230;</span> '. $term->name .' '.$termcount.'</p>';
  47.                     $termcount = '';
  48.                     $count++;
  49.                 }
  50.             }
  51.         ?>
  52.     </div>
  53. </div>
Add Comment
Please, Sign In to add comment