Guest User

calendar-frontpage.php

a guest
Jul 13th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.42 KB | None | 0 0
  1. <?php if(!isset($_REQUEST['show'])) {$show='grid';}
  2. else
  3. {$show=$_REQUEST['show'];}
  4. if($show=='grid'){?>
  5.  
  6.   <!--gridview calendar starts here-->
  7.     <div id="calendarwidgethp">                      
  8. <div id="tribe-events-content" class="grid">
  9.  
  10.       <!-- This title is here for ajax loading - do not remove if you wish to use ajax switching between month views -->
  11.  
  12.       <title><?php wp_title() ?></title>
  13.  
  14.         <div id='tribe-events-calendar-header' class="clearfix">
  15.  
  16.             <span class='tribe-events-month-nav'>
  17.  
  18.                 <?php /*?><span class='tribe-events-prev-month'>
  19.  
  20.                     <a href='<?php echo tribe_get_previous_month_link(); ?>'>
  21.  
  22.                     &#x2190; <?php echo tribe_get_previous_month_text(); ?>
  23.  
  24.                     </a>
  25.  
  26.                 </span><?php */?>
  27.  
  28.  
  29.  
  30.                 <?php //tribe_month_year_dropdowns( "tribe-events-" ); ?>
  31.                 <h2>Events for <span><?php echo date('F');?></span></h2>
  32.    
  33.  
  34.  
  35.                 <?php /*?><span class='tribe-events-next-month'>
  36.  
  37.                     <a href='<?php echo tribe_get_next_month_link(); ?>'>              
  38.  
  39.                     <?php echo tribe_get_next_month_text(); ?> &#x2192;
  40.  
  41.                     </a>
  42.  
  43.                <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading" id="ajax-loading" alt="" style='display: none'/>
  44.  
  45.                 </span>
  46. <?php */?>
  47.             </span>
  48.  
  49.  
  50.  
  51.             <span class='tribe-events-calendar-buttons'>
  52.  
  53.                 <a class='tribe-events-button-off' href='index.php?show=list'><?php _e('Event List', 'tribe-events-calendar')?></a>
  54.  
  55.                 <a class='tribe-events-button-on' href='index.php?show=grid'><?php _e('Calendar', 'tribe-events-calendar')?></a>
  56.  
  57.             </span>
  58.  
  59.         </div><!-- tribe-events-calendar-header -->
  60.  
  61.         <?php tribe_calendar_grid();//include(tribe_get_current_template()); // // See the views/table.php template for customization ?>
  62.  
  63.  
  64.  
  65.      <?php /*?> <?php if( function_exists( 'tribe_get_ical_link' ) ): ?>
  66.  
  67.          <a title="<?php esc_attr_e('iCal Import', 'tribe-events-calendar') ?>" class="ical" href="<?php echo tribe_get_ical_link(); ?>"><?php _e('iCal Import', 'tribe-events-calendar') ?></a>
  68.  
  69.       <?php endif; ?>
  70.  
  71.         <?php if (tribe_get_option('donate-link', false) == true) { ?>
  72.  
  73.             <p class="tribe-promo-banner"><?php echo apply_filters('tribe_promo_banner', sprintf( __('Calendar powered by %sThe Events Calendar%s', 'tribe-events-calendar'), '<a href="http://tri.be/wordpress-events-calendar/">', '</a>' ) ); ?></p>
  74.  
  75.         <?php } ?><?php */?>
  76.  
  77.     </div>
  78.      </div><!--calendarwidgethp-->                      
  79.      <!--gridview calendar ends here-->  
  80.  
  81.  
  82. <?php } else {?>
  83.  
  84.  
  85.      
  86.      <!-- list view of calendar starts here -->
  87.            
  88.  <div id="tribe-events-content" class="upcoming">
  89.     <?php if(!tribe_is_day()): // day view doesn't have a grid ?>
  90.         <div id='tribe-events-calendar-header' class="clearfix">
  91.         <span class='tribe-events-calendar-buttons'>
  92.             <a class='tribe-events-button-on' href='index.php?show=list'><?php _e('Event List', 'tribe-events-calendar')?></a>
  93.             <a class='tribe-events-button-off' href='index.php?show=grid'><?php _e('Calendar', 'tribe-events-calendar')?></a>
  94.         </span>
  95.  
  96.         </div><!--tribe-events-calendar-header-->
  97.  
  98.     <?php endif; ?>
  99.  
  100.     <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
  101. <h2 style="color: #666;float: left;font-size: 1.2em;margin-bottom: 26px;">Events for <span style="color: #222;"><?php echo date('F');?></span></h2>
  102. <?php
  103. if(!isset($terms_category)){$terms_category='tbilisi';}//if  in home page city name not assigned and so on the event category name
  104. $args = array(
  105.     'tax_query' => array(
  106.         array(
  107.             'taxonomy' => 'tribe_events_cat',
  108.             'field' => 'slug',
  109.             'terms' => $terms_category//in home page its assigned to mycity_event name
  110.         )
  111.     ),
  112.        'posts_per_page' => 30,'order'=>'ASC','orderby'=>'modified','post_type'=>'tribe_events','eventDisplay'=>'upcoming'
  113. );
  114. //$postslist = query_posts('order=ASC&orderby=modified&posts_per_page=4&post_type=tribe_events&eventDisplay=upcoming');
  115. $postslist = query_posts($args);?>
  116.     <?php if (have_posts()) : ?>
  117.  
  118.     <?php $hasPosts = true; $first = true; ?>
  119.  
  120.     <?php while ( have_posts() ) : the_post(); ?>
  121.    
  122.  
  123.         <?php global $more; $more = false; ?>
  124.    
  125.         <div id="post-<?php the_ID() ?>" <?php post_class('tribe-events-event clearfix') ?> itemscope itemtype="http://schema.org/Event">
  126.  
  127.             <?php if ( tribe_is_new_event_day() && !tribe_is_day() ) : ?>
  128.            
  129.                 <?php /*?><h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?></h4><?php */?>
  130.  
  131.             <?php endif; ?>
  132.  
  133.             <?php if ( tribe_is_day() && $first ) : $first = false; ?>
  134.  
  135.                 <h4 class="event-day"><?php echo tribe_event_format_date(strtotime(get_query_var('eventDate')), false); ?></h4>
  136.  
  137.             <?php endif; ?>
  138.  
  139.             <?php the_title('<h2 class="entry-title" itemprop="name"><a style="font-size: 0.9em;font-weight: bold;color: #58842F;" href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
  140.  
  141.             <div class="entry-content tribe-events-event-entry" itemprop="description">
  142.  
  143.                 <?php if (has_excerpt ()): ?>
  144.  
  145.                     <?php the_excerpt(); ?>
  146.  
  147.                 <?php else: ?>
  148.  
  149.                     <?php the_content(); ?>
  150.  
  151.                 <?php endif; ?>
  152.  
  153.             </div> <!-- End tribe-events-event-entry -->
  154.  
  155.             <div class="tribe-events-event-list-meta" itemprop="location" itemscope itemtype="http://schema.org/Place">
  156.  
  157.                 <table cellspacing="0">
  158.  
  159.                     <?php if (tribe_is_multiday() || !tribe_get_all_day()): ?>
  160.  
  161.                     <tr>
  162.  
  163.                         <td class="tribe-events-event-meta-desc"><?php _e('Start:', 'tribe-events-calendar') ?></td>
  164.  
  165.                         <td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
  166.  
  167.                     </tr>
  168.  
  169.                     <tr>
  170.  
  171.                         <td class="tribe-events-event-meta-desc"><?php _e('End:', 'tribe-events-calendar') ?></td>
  172.  
  173.                         <td class="tribe-events-event-meta-value" itemprop="endDate" content="<?php echo tribe_get_end_date(); ?>"><?php echo tribe_get_end_date(); ?></td>
  174.  
  175.                     </tr>
  176.  
  177.                     <?php else: ?>
  178.  
  179.                     <tr>
  180.  
  181.                         <td class="tribe-events-event-meta-desc"><?php _e('Date:', 'tribe-events-calendar') ?></td>
  182.  
  183.                         <td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
  184.  
  185.                     </tr>
  186.  
  187.                     <?php endif; ?>
  188.  
  189.  
  190.  
  191.                     <?php
  192.  
  193.                         $venue = tribe_get_venue();
  194.  
  195.                         if ( !empty( $venue ) ) :
  196.  
  197.                     ?>
  198.  
  199.                     <tr>
  200.  
  201.                         <td class="tribe-events-event-meta-desc"><?php _e('Venue:', 'tribe-events-calendar') ?></td>
  202.  
  203.                         <td class="tribe-events-event-meta-value" itemprop="name">
  204.  
  205.                             <? if( class_exists( 'TribeEventsPro' ) ): ?>
  206.  
  207.                                 <?php tribe_get_venue_link( get_the_ID(), class_exists( 'TribeEventsPro' ) ); ?>
  208.  
  209.                             <? else: ?>
  210.  
  211.                                 <?php echo tribe_get_venue( get_the_ID() ) ?>
  212.  
  213.                             <? endif; ?>
  214.  
  215.                         </td>
  216.  
  217.                     </tr>
  218.  
  219.                     <?php endif; ?>
  220.  
  221.                     <?php
  222.  
  223.                         $phone = tribe_get_phone();
  224.  
  225.                         if ( !empty( $phone ) ) :
  226.  
  227.                     ?>
  228.  
  229.                     <tr>
  230.  
  231.                         <td class="tribe-events-event-meta-desc"><?php _e('Phone:', 'tribe-events-calendar') ?></td>
  232.  
  233.                         <td class="tribe-events-event-meta-value" itemprop="telephone"><?php echo $phone; ?></td>
  234.  
  235.                     </tr>
  236.  
  237.                     <?php endif; ?>
  238.  
  239.                     <?php if (tribe_address_exists( get_the_ID() ) ) : ?>
  240.  
  241.                     <tr>
  242.  
  243.                         <td class="tribe-events-event-meta-desc"><?php _e('Address:', 'tribe-events-calendar'); ?><br />
  244.  
  245.                         <?php if( get_post_meta( get_the_ID(), '_EventShowMapLink', true ) == 'true' ) : ?>
  246.  
  247.                             <a class="gmap" itemprop="maps" href="<?php echo tribe_get_map_link(); ?>" title="Click to view a Google Map" target="_blank"><?php _e('Google Map', 'tribe-events-calendar' ); ?></a>
  248.  
  249.                         <?php endif; ?></td>
  250.  
  251.                         <td class="tribe-events-event-meta-value"><?php echo tribe_get_full_address( get_the_ID() ); ?></td>
  252.  
  253.                     </tr>
  254.  
  255.                     <?php endif; ?>
  256.  
  257.                     <?php
  258.  
  259.                         $cost = tribe_get_cost();
  260.  
  261.                         if ( !empty( $cost ) ) :
  262.  
  263.                     ?>
  264.  
  265.                     <tr>
  266.  
  267.                         <td class="tribe-events-event-meta-desc"><?php _e('Cost:', 'tribe-events-calendar') ?></td>
  268.  
  269.                         <td class="tribe-events-event-meta-value" itemprop="price"><?php echo $cost; ?></td>
  270.  
  271.                      </tr>
  272.  
  273.                     <?php endif; ?>
  274.  
  275.                 </table>
  276.  
  277.             </div>
  278.  
  279.         </div> <!-- End post -->
  280.  
  281.     <?php endwhile;// posts ?>
  282.  
  283.     <?php else :?>
  284.  
  285.         <?php
  286.  
  287.             $tribe_ecp = TribeEvents::instance();
  288.  
  289.             if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
  290.  
  291.                 $cat = get_term_by( 'slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy() );
  292.  
  293.                 if( tribe_is_upcoming() ) {
  294.  
  295.                     $is_cat_message = sprintf(__(' listed under %s. Check out past events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  296.  
  297.                 } else if( tribe_is_past() ) {
  298.  
  299.                     $is_cat_message = sprintf(__(' listed under %s. Check out upcoming events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  300.  
  301.                 }
  302.  
  303.             }
  304.  
  305.         ?>
  306.  
  307.         <?php if(tribe_is_day()): ?>
  308.  
  309.             <?php printf( __('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n('F d, Y', strtotime(get_query_var('eventDate')))); ?>
  310.  
  311.         <?php endif; ?>
  312.  
  313.  
  314.  
  315.         <?php if(tribe_is_upcoming()){ ?>
  316.  
  317.             <?php _e('No upcoming events', 'tribe-events-calendar');
  318.  
  319.             echo !empty($is_cat_message) ? $is_cat_message : ".";?>
  320.  
  321.  
  322.  
  323.         <?php }elseif(tribe_is_past()){ ?>
  324.  
  325.             <?php _e('No previous events' , 'tribe-events-calendar');
  326.  
  327.             echo !empty($is_cat_message) ? $is_cat_message : ".";?>
  328.  
  329.         <?php } ?>
  330.  
  331.        
  332.  
  333.     <?php endif; ?>
  334.  
  335.  
  336.  
  337.  
  338.  
  339.     </div><!-- #tribe-events-loop -->
  340.  
  341.     <div id="tribe-events-nav-below" class="tribe-events-nav clearfix">
  342.  
  343.  
  344.  
  345.         <div class="tribe-events-nav-previous"><?php /*?><?php
  346.  
  347.         // Display Previous Page Navigation
  348.  
  349.         if( tribe_is_upcoming() && get_previous_posts_link() ) : ?>
  350.  
  351.             <?php previous_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  352.  
  353.         <?php elseif( tribe_is_upcoming() && !get_previous_posts_link( ) ) : ?>
  354.  
  355.             <a href='<?php echo tribe_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', 'tribe-events-calendar' ); ?></span></a>
  356.  
  357.         <?php elseif( tribe_is_past() && get_next_posts_link( ) ) : ?>
  358.  
  359.             <?php next_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  360.  
  361.         <?php endif; ?><?php */?>
  362.  
  363.         </div>
  364.  
  365.  
  366.  
  367.         <?php /*?><div class="tribe-events-nav-next"><?php
  368.  
  369.         // Display Next Page Navigation
  370.  
  371.         if( tribe_is_upcoming() && get_next_posts_link( ) ) : ?>
  372.  
  373.             <?php next_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); ?>
  374.  
  375.         <?php elseif( tribe_is_past() && get_previous_posts_link( ) ) : ?>
  376.  
  377.             <?php previous_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); // a little confusing but in 'past view' to see newer events you want the previous page ?>
  378.  
  379.         <?php elseif( tribe_is_past() && !get_previous_posts_link( ) ) : ?>
  380.  
  381.             <a href='<?php echo tribe_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', 'tribe-events-calendar'); ?></span></a>
  382.  
  383.         <?php endif; ?>
  384.  
  385.         </div>
  386. <?php */?>
  387.  
  388.  
  389.     </div>
  390.  
  391.     <?php /*?><?php if ( !empty($hasPosts) && function_exists('tribe_get_ical_link') ): ?>
  392.  
  393.         <a title="<?php esc_attr_e('iCal Import', 'tribe-events-calendar') ?>" class="ical" href="<?php echo tribe_get_ical_link(); ?>"><?php _e('iCal Import', 'tribe-events-calendar') ?></a>
  394.  
  395.     <?php endif; ?><?php */?>
  396.  
  397. </div>  
  398.      <!-- list view of calendar ends here -->  
  399. <?php }?>
Advertisement
Add Comment
Please, Sign In to add comment