Advertisement
Beee

taxonomy-event-tags-idf.php

Sep 4th, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 KB | None | 0 0
  1. <?php
  2.     get_template_part('templates/page', 'header');
  3.  
  4.     $queried_object     = get_queried_object();
  5.     $term_id            = $queried_object->term_id;
  6.     $EM_Tag             = em_get_tag($term_id);
  7.     $home_url           = home_url();
  8.  
  9.     if ( current_user_can('manage_options') ) {
  10.         echo "\n<!-- taxonomy-event-tags-idf.php -->\n\n";
  11.     }
  12.  
  13.     if (class_exists('EM_Events')) {
  14.  
  15.         $format_header = '<table class="table table--events">
  16.            <thead>
  17.                <tr>
  18.                    <th class="event-date">Start - End</th>
  19.                    <th class="event-name">Event</th>
  20.                    <th class="event-country">Country</th>
  21.                    <th class="event-type">Type</th>
  22.                </tr>
  23.            </thead>
  24.            <tbody>';
  25.         $format = '<tr>
  26.                <td class="event-date">{not_long}#d/#m/#y{/not_long}{is_long}#d/#m #@_{ \- d/m/y} {/is_long}</td>
  27.                <td class="event-name">#_ADMINEDIT #_EVENTLINK</td>
  28.                <td class="event-country">{has_location}#_COUNTRYFLAG #_LOCATIONCOUNTRY{/has_location}</td>
  29.                <td class="idf-type">{has_tag_idf-wc}<a href="'. $home_url .'/events/tags/idf-wc" title="Click to see all IDF World Cup events">WC</a>{/has_tag_idf-wc}{has_tag_idf-wqs}<a href="'. $home_url .'/events/tags/idf-wqs" title="Click to see all IDF World Qualifier events">WQS</a>{/has_tag_idf-wqs}</td>
  30.            </tr>';
  31.  
  32.         echo "<div class=\"tag-header\"><img src=\"". get_stylesheet_directory_uri() ."/assets/images/logo-". $EM_Tag->slug .".png\" alt=\"All ". $EM_Tag->slug ." races\" /><h2 class=\"tag-description\">" . $EM_Tag->description . "</h2></div>";
  33.  
  34.         $scope = 'future';
  35.         $order = 'ASC';
  36.  
  37.         echo '<div class="entry-content">';
  38.  
  39.             if ( empty($_REQUEST['pno']) ) {
  40.  
  41.                 $coming_args = array(
  42.                     'order'         => $order,
  43.                     'limit'         => 30,
  44.                     'pagination'    => 1,
  45.                     'scope'         => $scope,
  46.                     'tag'           => $term_id,
  47.                     'format_header' => $format_header,
  48.                     'format'        => $format,
  49.                     'format_footer' => '</tbody></table>',
  50.                 );
  51.                 $coming_events = em_get_events( $coming_args );
  52.  
  53.                 if ( strlen($coming_events) > 125 ) {
  54.                     echo '<h2>Coming</h2>';
  55.                     echo $coming_events;
  56.                 } else {
  57.                     echo '<p>We have no coming events for this federation.</p>';
  58.                 }
  59.             }
  60.  
  61.             $past_args = array(
  62.                 'order'         => 'DESC',
  63.                 'limit'         =>  30,
  64.                 'mode'          => 'yearly',
  65.                 'pagination'    =>  1,
  66.                 'scope'         => 'past',
  67.                 'tag'           => $term_id,
  68.                 'format_header' => $format_header,
  69.                 'format'        => $format,
  70.                 'format_footer' => '</tbody></table>',
  71.             );
  72.             // $past_events = em_get_events( $past_args );
  73.             $past_events = EM_Events::output_grouped($past_args);
  74.  
  75.             if ( strlen($past_events) > 125 ) {
  76.                 echo '<h2>Past</h2>';
  77.                 echo $past_events;
  78.             } else {
  79.                 echo '<p>We have no past events for this federation.</p>';
  80.             }
  81.  
  82.         echo '</div>';
  83.  
  84.     } else {
  85.         echo "<p>Our events list is offline shortly due to maintenance.</p>";
  86.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement