Advertisement
nefi_c

event calendar custom loop

Jan 12th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.06 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Template Name: Home
  5. */
  6.  
  7. get_header(); ?>
  8.  
  9. <!-- carousel css/js code -->
  10. <style type="text/css">
  11. /* Circular Content Carousel Style */
  12. .ca-container{
  13.     position:relative;
  14.     margin:25px auto 20px auto;
  15.     width:990px;
  16.     height:450px;
  17. }
  18. .ca-wrapper{
  19.     width:100%;
  20.     height:100%;
  21.     position:relative;
  22. }
  23. .ca-item{
  24.     position:relative;
  25.     float:left;
  26.     width:330px;
  27.     height:100%;
  28.     text-align:center;
  29. }
  30. .ca-more{
  31.     position: absolute;
  32.     bottom: 10px;
  33.     right:0px;
  34.     padding:4px 15px;
  35.     font-weight:bold;
  36.     background: #ccbda2;
  37.     text-align:center;
  38.     color: white;
  39.     font-family: "Georgia","Times New Roman",serif;
  40.     font-style:italic;
  41.     text-shadow:1px 1px 1px #897c63;
  42. }
  43. .ca-close{
  44.     position:absolute;
  45.     top:10px;
  46.     right:10px;
  47.     background:#fff url(../images/cross.png) no-repeat center center;
  48.     width:27px;
  49.     height:27px;
  50.     text-indent:-9000px;
  51.     outline:none;
  52.     -moz-box-shadow:1px 1px 2px rgba(0,0,0,0.2);
  53.     -webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.2);
  54.     box-shadow:1px 1px 2px rgba(0,0,0,0.2);
  55.     opacity:0.7;
  56. }
  57. .ca-close:hover{
  58.     opacity:1.0;
  59. }
  60. .ca-item-main{
  61.     padding:20px;
  62.     position:absolute;
  63.     top:5px;
  64.     left:5px;
  65.     right:5px;
  66.     bottom:5px;
  67.     background:#fff;
  68.     overflow:hidden;
  69.     -moz-box-shadow:1px 1px 2px rgba(0,0,0,0.2);
  70.     -webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.2);
  71.     box-shadow:1px 1px 2px rgba(0,0,0,0.2);
  72. }
  73. .ca-icon{
  74.     width:233px;
  75.     height:189px;
  76.     position:relative;
  77.     margin:0 auto;
  78.     background:transparent url(../images/animal1.png) no-repeat center center;
  79. }
  80. .ca-item-2 .ca-icon{
  81.     background-image:url(../images/animal2.png);
  82. }
  83. .ca-item h3{
  84.     font-family: 'Coustard', sans-serif;
  85.     text-transform:uppercase;
  86.     font-size:30px;
  87.     color:#000;
  88.     margin-bottom:10px;
  89.     text-align:center;
  90.     text-shadow: 0px 1px 1px #e4ebe9;
  91. }
  92. .ca-item h4{
  93.     font-family: "Georgia","Times New Roman",serif;
  94.     font-style:italic;
  95.     font-size:12px;
  96.     text-align:left;
  97.     border-left:10px solid #b0ccc6;
  98.     padding-left:10px;
  99.     line-height:24px;
  100.     margin:10px;
  101.     position:relative;
  102. }
  103. .ca-item h4 span{
  104.     text-indent:40px;
  105.     display:block;
  106. }
  107. .ca-item h4  span.ca-quote{
  108.     color:#f4eee3;
  109.     font-size:100px;
  110.     position:absolute;
  111.     top:20px;
  112.     left:0px;
  113.     text-indent:0px;
  114. }
  115. .ca-content-wrapper{
  116.     background:#b0ccc6;
  117.     position:absolute;
  118.     width:0px; /* expands to width of the wrapper minus 1 element */
  119.     height:440px;
  120.     top:5px;
  121.     text-align:left;
  122.     z-index:10000;
  123.     overflow:hidden;
  124. }
  125. .ca-content{
  126.     width:660px;
  127.     border-bottom: 1px solid #f2f2f2;
  128.     text-align: center;
  129.     overflow:hidden;
  130. }
  131. .ca-content-text{
  132.     font-size: 14px;
  133.     font-style: italic;
  134.     font-family: "Georgia","Times New Roman",serif;
  135.     margin:10px 20px;
  136.     padding:10px 20px;
  137.     line-height:24px;
  138. }
  139. .ca-content-text p{
  140.     padding-bottom:5px;
  141. }
  142. .ca-content h6{
  143.     margin:25px 20px 0px 35px;
  144.     font-size:32px;
  145.     padding-bottom:5px;
  146.     color:#000;
  147.     font-family: 'Coustard', sans-serif;
  148.     color:#60817a;
  149.     border-bottom:2px solid #99bcb4;
  150.     text-shadow: 1px 1px 1px #99BCB4;
  151. }
  152. .ca-content ul{
  153.     margin:20px 35px;
  154.     height:30px;
  155. }
  156. .ca-content ul li{
  157.     float:left;
  158.     margin:0px 2px;
  159. }
  160. .ca-content ul li a{
  161.     color:#fff;
  162.     background:#000;
  163.     padding:3px 6px;
  164.     font-size:14px;
  165.     font-family: "Georgia","Times New Roman",serif;
  166.     font-style:italic;
  167. }
  168. .ca-content ul li a:hover{
  169.     background:#fff;
  170.     color:#000;
  171.     text-shadow:none;
  172. }
  173. .ca-nav span{
  174.     width:25px;
  175.     height:38px;
  176.     background:transparent url(../images/arrows.png) no-repeat top left;
  177.     position:absolute;
  178.     top:50%;
  179.     margin-top:-19px;
  180.     left:-40px;
  181.     text-indent:-9000px;
  182.     opacity:0.7;
  183.     cursor:pointer;
  184.     z-index:100;
  185. }
  186. .ca-nav span.ca-nav-next{
  187.     background-position:top right;
  188.     left:auto;
  189.     right:-40px;
  190. }
  191. .ca-nav span:hover{
  192.     opacity:1.0;
  193. }
  194. </style>
  195. <script type="text/javascript">
  196. (function(e){var t={navigate:function(t,n,r,i,s){var o=i.scroll,u=1,a=0;if(s.expanded){o=1;u=3;a=s.idxClicked}if(t===1){r.find("div.ca-item:lt("+o+")").each(function(t){e(this).clone(true).css("left",(s.totalItems-a+t)*s.itemW*u+"px").appendTo(r)})}else{var f=r.children().eq(0);r.find("div.ca-item:gt("+(s.totalItems-1-o)+")").each(function(t){e(this).clone(true).css("left",-(o-t+a)*s.itemW*u+"px").insertBefore(f)})}r.find("div.ca-item").each(function(n){var r=e(this);r.stop().animate({left:t===1?"-="+s.itemW*u*o+"px":"+="+s.itemW*u*o+"px"},i.sliderSpeed,i.sliderEasing,function(){if(t===1&&r.position().left<-a*s.itemW*u||t===-1&&r.position().left>(s.totalItems-1-a)*s.itemW*u){r.remove()}s.isAnimating=false})})},openItem:function(e,n,r,i){i.idxClicked=n.index();i.winpos=t.getWinPos(n.position().left,i);e.find("div.ca-item").not(n).hide();n.find("div.ca-content-wrapper").css("left",i.itemW+"px").stop().animate({width:i.itemW*2+"px",left:i.itemW+"px"},r.itemSpeed,r.itemEasing).end().stop().animate({left:"0px"},r.itemSpeed,r.itemEasing,function(){i.isAnimating=false;i.expanded=true;t.openItems(e,n,r,i)})},openItems:function(n,r,i,s){var o=r.index();n.find("div.ca-item").each(function(n){var r=e(this),i=r.index();if(i!==o){r.css("left",-(o-i)*s.itemW*3+"px").show().find("div.ca-content-wrapper").css({left:s.itemW+"px",width:s.itemW*2+"px"});t.toggleMore(r,false)}})},toggleMore:function(e,t){t?e.find("a.ca-more").show():e.find("a.ca-more").hide()},closeItems:function(n,r,i,s){var o=r.index();r.find("div.ca-content-wrapper").stop().animate({width:"0px"},i.itemSpeed,i.itemEasing).end().stop().animate({left:s.itemW*(s.winpos-1)+"px"},i.itemSpeed,i.itemEasing,function(){s.isAnimating=false;s.expanded=false});t.toggleMore(r,true);n.find("div.ca-item").each(function(n){var r=e(this),i=r.index();if(i!==o){r.find("div.ca-content-wrapper").css({width:"0px"}).end().css("left",(s.winpos-1-(o-i))*s.itemW+"px").show();t.toggleMore(r,true)}})},getWinPos:function(e,t){switch(e){case 0:return 1;break;case t.itemW:return 2;break;case t.itemW*2:return 3;break}}},n={init:function(n){if(this.length){var r={sliderSpeed:500,sliderEasing:"easeOutExpo",itemSpeed:500,itemEasing:"easeOutExpo",scroll:1};return this.each(function(){if(n){e.extend(r,n)}var i=e(this),s=i.find("div.ca-wrapper"),o=s.children("div.ca-item"),u={};u.itemW=o.width();u.totalItems=o.length;if(u.totalItems>3)i.prepend('<div class="ca-nav"><span class="ca-nav-prev">Previous</span><span class="ca-nav-next">Next</span></div>');if(r.scroll<1)r.scroll=1;else if(r.scroll>3)r.scroll=3;var a=i.find("span.ca-nav-prev"),f=i.find("span.ca-nav-next");s.css("overflow","hidden");o.each(function(t){e(this).css({position:"absolute",left:t*u.itemW+"px"})});i.find("a.ca-more").live("click.contentcarousel",function(n){if(u.isAnimating)return false;u.isAnimating=true;e(this).hide();var i=e(this).closest("div.ca-item");t.openItem(s,i,r,u);return false});i.find("a.ca-close").live("click.contentcarousel",function(n){if(u.isAnimating)return false;u.isAnimating=true;var i=e(this).closest("div.ca-item");t.closeItems(s,i,r,u);return false});a.bind("click.contentcarousel",function(e){if(u.isAnimating)return false;u.isAnimating=true;t.navigate(-1,i,s,r,u)});f.bind("click.contentcarousel",function(e){if(u.isAnimating)return false;u.isAnimating=true;t.navigate(1,i,s,r,u)});i.bind("mousewheel.contentcarousel",function(e,n){if(n>0){if(u.isAnimating)return false;u.isAnimating=true;t.navigate(-1,i,s,r,u)}else{if(u.isAnimating)return false;u.isAnimating=true;t.navigate(1,i,s,r,u)}return false})})}}};e.fn.contentcarousel=function(t){if(n[t]){return n[t].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof t==="object"||!t){return n.init.apply(this,arguments)}else{e.error("Method "+t+" does not exist on jQuery.contentcarousel")}}})(jQuery);(function(e){function n(t){var n=t||window.event,r=[].slice.call(arguments,1),i=0,s=true,o=0,u=0;t=e.event.fix(n);t.type="mousewheel";if(t.wheelDelta){i=t.wheelDelta/120}if(t.detail){i=-t.detail/3}u=i;if(n.axis!==undefined&&n.axis===n.HORIZONTAL_AXIS){u=0;o=-1*i}if(n.wheelDeltaY!==undefined){u=n.wheelDeltaY/120}if(n.wheelDeltaX!==undefined){o=-1*n.wheelDeltaX/120}r.unshift(t,i,o,u);return e.event.handle.apply(this,r)}var t=["DOMMouseScroll","mousewheel"];e.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var e=t.length;e;){this.addEventListener(t[--e],n,false)}}else{this.onmousewheel=n}},teardown:function(){if(this.removeEventListener){for(var e=t.length;e;){this.removeEventListener(t[--e],n,false)}}else{this.onmousewheel=null}}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})})(jQuery)
  197. jQuery(document).ready(function(){
  198.     jQuery('#ca-container').contentcarousel();
  199. });
  200. </script>
  201. <!-- end carousel css/js code -->
  202.  
  203. <div class="royalSlider rsDefaultInv visibleNearbySimple rsHor rsWebkit3d">
  204.   <?php
  205.  
  206.     global $post;
  207.  
  208.     $all_events = tribe_get_events(
  209.         array(
  210.             'posts_per_page'=>3,
  211.             'tax_query'=> array(
  212.                 array(
  213.                     'taxonomy' => 'tribe_events_cat',
  214.                     'field' => 'slug',
  215.                     'terms' => 'featured'
  216.                 )
  217.             )
  218.         )
  219.     );
  220.  
  221.     foreach($all_events as $post) {
  222.  
  223.     setup_postdata($post);
  224.  
  225.     ?>
  226.  
  227.     <?php $terms = get_the_terms( $post->ID, 'tribe_events_cat' ); ?>
  228.  
  229.     <div class="<?php foreach( $terms as $term ) echo ' ' . $term->slug; ?>">
  230.  
  231.     <?php
  232.         $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
  233.         if ($image) : ?>
  234.         <img class="rsImg" src="<?php echo $image[0]; ?>" alt="" />
  235.         <?php endif; ?>
  236.  
  237.         <div class="rsABlock clearfix">
  238.             <div class="slider-title">
  239.                 <h3><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
  240.                 <h4><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date(); ?></h4>
  241.             </div>
  242.             <div class="slider-excerpt">
  243.                 <p><?php the_excerpt();?></p>
  244.                 <a href="<?php the_permalink();?>">Read more&hellip;</a>
  245.             </div>
  246.         </div>
  247.     </div>
  248.  
  249.   <?php
  250.   } //endforeach
  251.   ?>
  252.  
  253.   <?php wp_reset_query(); ?>
  254. </div>
  255.  
  256. <div id="page">
  257.   <section>
  258.     <div id="ca-container" class="ca-container" style="overflow: hidden;">
  259.       <div class="ca-wrapper">
  260. <?php
  261.         global $post;
  262.  
  263.         $current_date = date('j M Y');
  264.         /* get upcoming 30 day event, you can edit this to less day */
  265.         $end_date = date('j M Y', strtotime('30 days'));
  266.  
  267.         $terms = get_terms( 'tribe_events_cat', 'hide_empty=0' );
  268.         $i = 1;
  269.         foreach($terms as $tribe_category){
  270.  
  271.         echo '<div class="ca-item ca-item-'.$i.'">'; $i++;
  272.            
  273.             /* Featured Event */
  274.  
  275.             $all_events_one = tribe_get_events(
  276.                     array(
  277.                             'post_type'     => 'tribe_events',
  278.                             'start_date'    => $current_date,
  279.                             'end_date'      => $end_date,
  280.                             'eventDisplay'  => 'upcoming',
  281.                             'posts_per_page'=> 1,
  282.                             'tax_query'=> array(
  283.                                     array(
  284.                                         'taxonomy' => 'tribe_events_cat',
  285.                                         'field' => 'slug',
  286.                                         'terms' => $tribe_category
  287.                                     )
  288.                             )
  289.                     )
  290.             );
  291.  
  292.             /* Sub Event */
  293.             $all_events_two = tribe_get_events(
  294.                     array(
  295.                             'post_type'     => 'tribe_events',
  296.                             'start_date'    => $current_date,
  297.                             'end_date'      => $end_date,
  298.                             'eventDisplay'  => 'upcoming',
  299.                             'posts_per_page'=> 3,
  300.                             'offset'        => 1,
  301.                             'tax_query'=> array(
  302.                                     array(
  303.                                         'taxonomy' => 'tribe_events_cat',
  304.                                         'field' => 'slug',
  305.                                         'terms' => $tribe_category
  306.                                     )
  307.                             )
  308.                     )
  309.             );
  310.  
  311.             foreach($all_events_one as $post) {
  312.                 setup_postdata($post);
  313.             ?>
  314.             <div class="ca-item-main">
  315.                 <h3><?php the_title(); ?></h3>
  316.                 <span class="event-date"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span>
  317.  
  318.                 <?php if ( has_post_thumbnail() ) { ?>
  319.                     <div class="event-thumb">
  320.                         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
  321.                     </div>
  322.                     <div class="event-excerpt">
  323.                         <?php the_excerpt(); ?>
  324.                     </div>
  325.                 <?php } else { ?>
  326.                     <div class="event-content">
  327.                         <?php the_content(); ?>
  328.                     </div>
  329.                 <?php } ?>
  330.                 <a href="#" class="ca-more" style="display: block;">more...</a>
  331.             </div>
  332.  
  333.         <?php
  334.             } //endforeach
  335.                 wp_reset_query(); ?>
  336.  
  337.             <!-- start sub-event -->
  338.             <div class="ca-content-wrapper">
  339.         <?php
  340.             foreach($all_events_two as $post) {
  341.             setup_postdata($post);
  342.         ?>
  343.                 <div class="ca-content">
  344.                     <h3><?php the_title(); ?></h3>
  345.                     <?php the_excerpt(); ?>
  346.                 </div>
  347.         <?php
  348.             } // end foreach
  349.                 wp_reset_query(); ?>
  350.             <!-- end sub-event -->
  351.                 <a href="#" class="ca-close">close</a>
  352.             </div>
  353.            
  354. <?php
  355.         echo '</div>'; // end div.ca-item
  356.         } // end foreach($terms as $tribe_category)
  357. ?>
  358.       </div>
  359.       <!-- ca-wrapper -->
  360.     </div>
  361.     <!-- ca-container -->
  362.   </section>
  363.   <section class="clearfix">
  364.     <div class="quater-column left">
  365.       <?php if ( ! dynamic_sidebar( 'homepage-left-widgets' ) ) : ?>
  366.       <?php endif; // end homepage widget area ?>
  367.     </div>
  368.     <div class="half-column left">
  369.       <?php get_template_part('calendar'); ?>
  370.     </div>
  371.     <div class="quarter-column right">
  372.       <?php if ( ! dynamic_sidebar( 'homepage-right-widgets' ) ) : ?>
  373.       <?php endif; // end homepage widget area ?>
  374.     </div>
  375.   </section>
  376. </div>
  377.  
  378. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement