Advertisement
jonahcoyote

Full Featured Widget

Nov 17th, 2011
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.61 KB | None | 0 0
  1. <?php
  2.  
  3. // Vars set:
  4. // '$event->AllDay',
  5. // '$event->StartDate',
  6. // '$event->EndDate',
  7. // '$event->ShowMapLink',
  8. // '$event->ShowMap',
  9. // '$event->Cost',
  10. // '$event->Phone',
  11.  
  12. // Don't load directly
  13. if ( !defined('ABSPATH') ) { die('-1'); }
  14.  
  15. $event = array();
  16. $tribe_ecp = TribeEvents::instance();
  17. reset($tribe_ecp->metaTags); // Move pointer to beginning of array.
  18. foreach($tribe_ecp->metaTags as $tag){
  19.     $var_name = str_replace('_Event','',$tag);
  20.     $event[$var_name] = tribe_get_event_meta( $post->ID, $tag, true );
  21. }
  22.  
  23. $event = (object) $event; //Easier to work with.
  24.  
  25. ob_start();
  26.     post_class($alt_text,$post->ID);
  27. $class = ob_get_contents();
  28. ob_end_clean();
  29. ?>
  30.  
  31. <?php
  32. //check if $i is zero and if so we're looking at the first record
  33.  
  34. if($i == 0) { ?>
  35.  
  36. <div class="event">
  37.     <?php if(has_post_thumbnail($post->ID, 'thumbnail')):
  38.     $image_id = get_post_thumbnail_id($post->ID);
  39.     $image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true); ?>
  40.         <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>
  41.     <?php endif; ?>
  42.     <a href="<?php echo get_permalink($post->ID) ?>"><?php echo $post->post_title ?></a>
  43. </div>
  44. <div class="when">
  45.     <?php
  46.         echo tribe_get_start_date( $post->ID, isset($start) ? $start : null );
  47.  
  48.         if($event->AllDay && $start)
  49.             echo ' <small>('.__('All Day','tribe-events-calendar-pro').')</small>';
  50.     ?>
  51. </div>
  52. <div class="loc">
  53.     <?php
  54.         if ( tribe_get_city() != '' ) {
  55.             echo tribe_get_city() . ', ';
  56.         }
  57.         if (tribe_get_region() != '') {
  58.             echo tribe_get_region() . ', ';
  59.         }
  60.         if (tribe_get_country() != '') {
  61.             echo tribe_get_country();
  62.         }
  63.     ?>
  64. </div>
  65. <div class="event_body">
  66.     <?php the_content('... More');?>
  67. </div>
  68. <?php $alt_text = ( empty( $alt_text ) ) ? 'alt' : ''; ?>
  69.  
  70.  <?php } else { ?>
  71.  
  72.  <div class="event">
  73.     <a href="<?php echo get_permalink($post->ID) ?>"><?php echo $post->post_title ?></a>
  74. </div>
  75. <div class="when">
  76.     <?php
  77.         echo tribe_get_start_date( $post->ID, isset($start) ? $start : null );
  78.  
  79.         if($event->AllDay && $start)
  80.             echo ' <small>('.__('All Day','tribe-events-calendar-pro').')</small>';
  81.     ?>
  82. </div>
  83. <div class="loc">
  84.     <?php
  85.         if ( tribe_get_city() != '' ) {
  86.             echo tribe_get_city() . ', ';
  87.         }
  88.         if (tribe_get_region() != '') {
  89.             echo tribe_get_region() . ', ';
  90.         }
  91.         if (tribe_get_country() != '') {
  92.             echo tribe_get_country();
  93.         }
  94.     ?>
  95. </div>
  96. <div class="event_body">
  97.     <?php the_content('... More');?>
  98. </div>
  99. <?php $alt_text = ( empty( $alt_text ) ) ? 'alt' : ''; ?>
  100.  
  101.  <?php }
  102.  $i++;
  103.  ?>
  104.  
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement