Guest User

list-widget.php

a guest
Jul 26th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.47 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. <?php $current_date = date("Y-m-d H:i:s"); ?>
  21.  
  22. <li>
  23.  <?php
  24.   $args=array(
  25. 'post_type' =>'tribe_events',
  26. 'eventDisplay' => 'custom',
  27. 'showposts' => 5,
  28. 'start_date' => $current_date,
  29. 'end_date' => $current_date
  30. );
  31.  $my_query = null;
  32.  $my_query = new WP_Query($args);
  33.  if( $my_query->have_posts() ) {
  34.  while ($my_query->have_posts()) : $my_query->the_post(); ?>
  35. <?php if(has_post_thumbnail($post->ID, 'thumbnail')):
  36. $image_id = get_post_thumbnail_id($post->ID);
  37. $image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true); ?>
  38. <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>
  39. <?php endif; ?>
  40.     <div class="table-height">
  41.     <h4 class="entry-title summary">
  42.             <a href="<?php echo tribe_get_event_link(); ?>" rel="bookmark"><?php the_title(); ?></a>
  43.     </h4>
  44.     <div class="duration">
  45.             <?php echo tribe_events_event_schedule_details(); ?>   
  46.     </div>
  47.     <div>
  48.             <a href="<?php echo tribe_get_event_website_link(); ?>" target="_blank" rel="bookmark">View Website</a>
  49.     </div>
  50.     <div>
  51.             <?php the_excerpt() ?>
  52.     </div>
  53.     <div>
  54.     <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>
  55.     </div>
  56.     </div>
  57.     <?php if ( $cost && tribe_get_cost() != '' ) { ?>
  58.         <span class="tribe-events-divider">|</span>
  59.         <div class="tribe-events-event-cost">
  60.             <?php echo tribe_get_cost( null, true ); ?>
  61.         </div>
  62.     <?php } ?>         
  63.     <div class="vcard adr location">   
  64.  
  65.         <?php if ( $venue  && tribe_get_venue() != '') { ?>
  66.             <span class="fn org tribe-venue"><?php echo tribe_get_venue_link(); ?></span>
  67.         <?php } ?>
  68.  
  69.         <?php if ( $address && tribe_get_address() != '' ) { ?>
  70.             <span class="street-address"><?php echo tribe_get_address(); ?></span>
  71.         <?php } ?>
  72.  
  73.         <?php if ( $city && tribe_get_city() != '' ) { ?>
  74.             <span class="locality"><?php echo tribe_get_city(); ?></span>
  75.         <?php } ?>
  76.  
  77.         <?php if ( $region && tribe_get_region() !='' ) { ?>
  78.             <span class="region"><?php echo tribe_get_region(); ?></span>
  79.         <?php   } ?>
  80.  
  81.         <?php if ( $zip && tribe_get_zip() != '' ) { ?>
  82.             <span class="postal-code"><?php echo tribe_get_zip(); ?></span>
  83.         <?php } ?>
  84.  
  85.         <?php if ( $country  && tribe_get_country() != '') { ?>
  86.             <span class="country-name"><?php echo tribe_get_country(); ?></span>
  87.         <?php } ?>
  88.  
  89.         <?php if ( $organizer && tribe_get_organizer() != '' ) { ?>
  90.         <?php _e( 'Organizer:', 'tribe-events-calendar-pro' ); ?>
  91.                 <span class="tribe-organizer"><?php echo tribe_get_organizer_link(); ?></span>
  92.         <?php } ?>
  93.  
  94.         <?php if ( $phone && tribe_get_phone() != '' ) { ?>
  95.             <span class="tel"><?php echo tribe_get_phone(); ?></span>
  96.         <?php } ?>
  97.     </div>
  98.     <?php
  99.       endwhile;
  100.     }
  101.     wp_reset_query();?>
  102. </li>
Advertisement
Add Comment
Please, Sign In to add comment