nefi_c

event calendar custom loop #2

Jan 20th, 2013
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.77 KB | None | 0 0
  1. <!-- box css/js code -->
  2. <style type="text/css">
  3. .events-cat-menu,#dateList{padding:0}
  4. .blackBar {width: 100%; text-align: center; line-height: 48px; background: #000; height: 48px; font-size: 10px; line-height: 48px; color: #aaa; letter-spacing: .7px;}
  5. #loadMore {margin-top: -3px; border-top:3px solid #000; line-height: 45px; height: 45px;
  6.     display: none;
  7. }
  8. #loadMore a {color: #f8f8f8; line-height: 45px;}
  9. #loadMore a:hover {color: #f8f8f8;}
  10.  
  11. #filter ul {list-style: none;}
  12. #filter li {display: inline; font-size: 10px; line-height: 48px; margin: 0 8px 0 0; }
  13. #filter li a {color: #aaa; text-transform: uppercase; line-height: 48px; display: inline-block;}
  14. #filter li a:hover,
  15. #filter li a.active {color: #fff;}
  16.  
  17. #filter.sticky {z-index: 2000; width: 100%}
  18. #filterStickyWrapper,
  19. #filterStickyWrapper #filter {width: 100% !important; left: 0 !important;}
  20.  
  21. li.box {display: block; float: left; height: 150px; width: 150px; position: relative; overflow: hidden; text-align: center; border-bottom: 3px solid #000; font-weight: bold;}
  22. li.box a {display: block; height: 96px; width: 116px; padding: 27px 17px; color: #000;}
  23. li.box .theDay {font-size:45px; line-height: 50px; }
  24. li.box .theTitle {font-size: 11px; line-height: 14px; font-family: sans-serif; letter-spacing: .5px;font-family: serif;font-style: italic;}
  25. li.box .theTitle span {text-transform: uppercase;  display: inline-block; padding: 2px 8px 0; margin-bottom: 8px; background: #000; color: #f8f8f8; font-size: 9px; font-family: sans-serif; font-style: normal; -moz-border-radius: 15px; -webkit-border-radius: 15px; border-radius: 15px;}
  26. li#theEnd {background: #000; color: #f8f8f8; line-height: 160px;}
  27. li.monthYear {background-color: #000; color: #f8f8f8; text-transform: uppercase; font-size: 24px; line-height: 24px; cursor: default;background-image: none;}
  28. li.monthYear a.dateLink {padding: 0; color: #f8f8f8; padding-top: 40px; height: 110px; width: 100%;}
  29. li.monthYear a.dateLink:hover {color: #000;}
  30. li.monthYear span {letter-spacing: 2.5px;}
  31. /*--BACKGROUND COLOR STUFF--*/
  32. li.box a:hover,
  33. .dateInfo:hover,
  34. #wp-calendar td a:hover,
  35. #commentform input[type="submit"]:hover,
  36. input[type="submit"]:hover,
  37. #postNav .pagenav a:hover,
  38. #theTags a:hover,
  39. #tagLine a:hover,
  40. .sliderInfo a:hover,
  41. .flex-direction-nav li a:hover,
  42. #dropmenu li a:hover {background-color:#2ea7fb;}
  43. /*-----HOVER ANIMATION STUFF------*/
  44. ol.flex-control-nav li a,
  45. li.box a,
  46. .dateInfo,
  47. #wp-calendar td a,
  48. #commentform input[type="submit"],
  49. input[type="submit"],
  50. #postNav .pagenav a,
  51. #theTags a,
  52. #tagLine a,
  53. #dropmenu li a,
  54. #dropmenu li,
  55. #dropmenu li a,
  56. #tagLine a,
  57. #theTags a,
  58. .widget_tag_cloud a,
  59. #postNav a,
  60. .sliderInfo a,
  61. .flex-direction-nav li a,
  62. .dateInfo,
  63. ul#detailsTabs > li {
  64.     -moz-transition:background-color 0.20s linear;
  65.     -webkit-transition:background-color 0.20s linear;
  66.     -o-transition:background-color 0.20s linear;
  67. }
  68. </style>
  69. <script type="text/javascript">
  70. jQuery(document).ready(function(){
  71.     //FILTER EFFECTS & APPEARANCE
  72.     var filterLink = jQuery('#filter a');
  73.     filterLink.click(function(){
  74.    
  75.         jQuery('li.box').removeClass('hideMe');
  76.        
  77.         filterLink.not(this).removeClass('active');
  78.         jQuery(this).addClass('active');
  79.        
  80.         var activeCat = jQuery(this).html().toLowerCase().replace(/ /g,'');
  81.        
  82.         jQuery('li.postEvent').not('li.'+ activeCat).addClass('hideMe').children().stop(true,true).animate({opacity:".1"},350);
  83.         jQuery('li.'+ activeCat).children().stop(true,true).animate({opacity:"1"},350);
  84.        
  85.         return false;
  86.     });
  87.     jQuery('#filter li').not(':first').prepend("/ &nbsp;&nbsp;&nbsp;");
  88. });
  89. </script>
  90. <!-- end carousel css/js code -->
  91.  
  92. <!--FILTER-->
  93. <div id="filter" class="blackBar">
  94. <?php
  95. $terms = get_terms("tribe_events_cat");
  96. $count = count($terms);
  97. if ( $count > 0 ){
  98.     echo '<ul class="events-cat-menu">';
  99.     foreach ( $terms as $term ) {
  100.             echo '<li class="cat_'. $term->slug .'"><a href="'. get_term_link($term->slug, 'tribe_events_cat') .'">' . $term->name . '</a></li>';
  101.     }
  102.     echo '</ul>';
  103. }
  104. ?>
  105. </div>
  106.  
  107. <!--UL DATE LIST-->
  108. <ul id="dateList">
  109. <?php
  110. $prev_month = '';
  111. $prev_year = '';
  112.  
  113. $current_date = date('j M Y');
  114. /* get upcoming 365 day event, you can edit this to less day */
  115. $end_date = date('j M Y', strtotime('365 days'));
  116.  
  117. $all_events = tribe_get_events(
  118.     array(
  119.         'post_type'     => 'tribe_events',
  120.         'start_date'    => $current_date,
  121.         'end_date'      => $end_date,
  122.         'eventDisplay'  => 'upcoming',
  123.         'posts_per_page'=> -1
  124.     )
  125. );
  126.  
  127. foreach($all_events as $post) {
  128.     setup_postdata($post);
  129.     $category = get_the_terms($post->ID,'tribe_events_cat');
  130.     if(tribe_get_start_date($post->ID, false, 'M') != $prev_month || tribe_get_start_date($post->ID, false, 'Y') != $prev_year){
  131. ?>
  132.     <li class="box monthYear" id="<?php echo tribe_get_start_date($post->ID, false, 'M'); echo tribe_get_start_date($post->ID, false, 'y'); ?>">
  133.         <a class="dateLink" href="<?php echo home_url(); ?>/<?php echo tribe_get_start_date($post->ID, false, 'Y/m'); ?>">
  134.             <span><?php echo tribe_get_start_date($post->ID, false, 'M'); ?></span><br />
  135.             <?php echo tribe_get_start_date($post->ID, false,'Y'); ?>
  136.         </a>
  137.     </li>
  138. <?php } ?>
  139.     <li class="box postEvent<?php foreach ($category as $cat){ echo ' '.$cat->name; } ?>">
  140.         <a  href="<?php the_permalink(); ?>">
  141.             <span class="theDay"><?php echo tribe_get_start_date($post->ID, false, 'd'); ?></span><br />
  142.             <p class="theTitle">
  143.                 <span><?php echo tribe_get_start_date($post->ID, false, 'D @ g:i a'); ?></span><br />
  144.                 <?php echo the_title(); ?>
  145.             </p>
  146.         </a>                    
  147.     </li>
  148. <?php
  149.     $prev_month = tribe_get_start_date($post->ID, false, 'M');
  150.     $prev_year = tribe_get_start_date($post->ID, false, 'Y');
  151. }
  152. ?>
  153.     <li class="box" id="theEnd"><?php _e("The End.");?></li>
  154.  
  155. </ul><!--END DATE LIST-->
Advertisement
Add Comment
Please, Sign In to add comment