Guest User

list-widget.php

a guest
Jul 26th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.42 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Events Pro List Widget Template
  4.  * This is the template for the output of the events list widget.
  5.  * All the items are turned on and off through the widget admin.
  6.  * There is currently no default styling, which is highly needed.
  7.  *
  8.  * Override this template in your own theme by creating a file at [your-theme]/tribe-events/widgets/list-widget.php
  9.  *
  10.  * When the template is loaded, the following vars are set: $start, $end, $venue,
  11.  * $address, $city, $state, $province'], $zip, $country, $phone, $cost
  12.  *
  13.  * @package TribeEventsCalendarPro
  14.  * @since  1.0
  15.  * @author Modern Tribe Inc.
  16.  *
  17.  */
  18.  
  19. if ( !defined('ABSPATH') ) { die('-1'); } ?>
  20.  
  21. <li>
  22.  <?php
  23.   $args=array(
  24. 'post_type' =>'tribe_events',
  25. 'eventDisplay' => 'custom',
  26. 'showposts' => 5,
  27. 'start_date' => $current_date,
  28. 'end_date' => $current_date
  29. );
  30.  $my_query = null;
  31.  $my_query = new WP_Query($args);
  32.  if( $my_query->have_posts() ) {
  33.  while ($my_query->have_posts()) : $my_query->the_post(); ?>
  34. <?php if(has_post_thumbnail($post->ID, 'thumbnail')):
  35. $image_id = get_post_thumbnail_id($post->ID);
  36. $image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true); ?>
  37. <a href="<?php echo get_permalink($post->ID) ?>" class="post-thumb"><img src="<?php echo $image_url[0]; ?>" alt="<?php echo $post->post_title ?>" /></a>
  38. <?php endif; ?>
  39.     <div class="table-height">
  40.     <h4 class="entry-title summary">
  41.             <a href="<?php echo tribe_get_event_link(); ?>" rel="bookmark"><?php the_title(); ?></a>
  42.     </h4>
  43.     <div class="duration">
  44.             <?php echo tribe_events_event_schedule_details(); ?>   
  45.     </div>
  46.     <div>
  47.             <a href="<?php echo tribe_get_event_website_link(); ?>" target="_blank" rel="bookmark">View Website</a>
  48.     </div>
  49.     <div>
  50.             <?php the_excerpt() ?>
  51.     </div>
  52.     <div>
  53.     <a href="<?php echo tribe_get_event_link() ?>" class="tribe-events-read-more" rel="bookmark"><?php _e( 'Find out more', 'tribe-events-calendar' ) ?> &raquo;</a>
  54.     </div>
  55.     </div>
  56.     <?php if ( $cost && tribe_get_cost() != '' ) { ?>
  57.         <span class="tribe-events-divider">|</span>
  58.         <div class="tribe-events-event-cost">
  59.             <?php echo tribe_get_cost( null, true ); ?>
  60.         </div>
  61.     <?php } ?>         
  62.     <div class="vcard adr location">   
  63.  
  64.         <?php if ( $venue  && tribe_get_venue() != '') { ?>
  65.             <span class="fn org tribe-venue"><?php echo tribe_get_venue_link(); ?></span>
  66.         <?php } ?>
  67.  
  68.         <?php if ( $address && tribe_get_address() != '' ) { ?>
  69.             <span class="street-address"><?php echo tribe_get_address(); ?></span>
  70.         <?php } ?>
  71.  
  72.         <?php if ( $city && tribe_get_city() != '' ) { ?>
  73.             <span class="locality"><?php echo tribe_get_city(); ?></span>
  74.         <?php } ?>
  75.  
  76.         <?php if ( $region && tribe_get_region() !='' ) { ?>
  77.             <span class="region"><?php echo tribe_get_region(); ?></span>
  78.         <?php   } ?>
  79.  
  80.         <?php if ( $zip && tribe_get_zip() != '' ) { ?>
  81.             <span class="postal-code"><?php echo tribe_get_zip(); ?></span>
  82.         <?php } ?>
  83.  
  84.         <?php if ( $country  && tribe_get_country() != '') { ?>
  85.             <span class="country-name"><?php echo tribe_get_country(); ?></span>
  86.         <?php } ?>
  87.  
  88.         <?php if ( $organizer && tribe_get_organizer() != '' ) { ?>
  89.         <?php _e( 'Organizer:', 'tribe-events-calendar-pro' ); ?>
  90.                 <span class="tribe-organizer"><?php echo tribe_get_organizer_link(); ?></span>
  91.         <?php } ?>
  92.  
  93.         <?php if ( $phone && tribe_get_phone() != '' ) { ?>
  94.             <span class="tel"><?php echo tribe_get_phone(); ?></span>
  95.         <?php } ?>
  96.     </div>
  97.     <?php
  98.       endwhile;
  99.     }
  100.     wp_reset_query();?>
  101. </li>
Advertisement
Add Comment
Please, Sign In to add comment