Advertisement
Guest User

Modification for WP-plugin event-calendar-3

a guest
May 14th, 2011
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. /** Template function. Call this from your template to insert posts of
  2.  *  forthcoming events.
  3.  */
  4.  
  5. function ec3_get_events_posts()
  6. {
  7.   if(!ec3_check_installed(__('Upcoming Events','ec3')))
  8.     return;
  9.  
  10.   global $ec3,$wpdb,$wp_version, $post;
  11.  
  12.   // Find the upcoming events.
  13.   $querystring =
  14.     "SELECT DISTINCT wposts.*, s.*
  15.     FROM $wpdb->posts wposts, $ec3->schedule s
  16.     WHERE wposts.id=s.post_id
  17.         AND wposts.post_status='publish'
  18.         AND s.end>='$ec3->today'
  19.     ORDER BY start";
  20.  
  21.   $calendar_entries = $wpdb->get_results($querystring);
  22.  
  23.   echo "<!-- Generated by Event Calendar v$ec3->version -->\n";
  24.   if($calendar_entries)
  25.   {
  26.     foreach ($calendar_entries as $post):
  27.     $post->ec3_schedule[]=$post;
  28.     setup_postdata($post); ?>
  29.     <div class="post" id="post-<?php the_ID(); ?>">
  30.         <h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  31.         <div class="entry">
  32.             <?php the_content('Read the rest of this entry &raquo;'); ?>
  33.         </div>
  34.         <div class="btm"><p class="meta">Posted by <?php the_author() ?> under <?php the_category(', ') ?>
  35.             <?php the_tags('Tags: ', ', ', ''); ?>
  36.             &nbsp;&bull;&nbsp;
  37.             <?php edit_post_link('Edit', '', '&nbsp;&bull;&nbsp;'); ?>
  38.             <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></p>
  39.         </div>
  40.     </div>
  41.   <?php endforeach;  
  42.   }
  43.   else
  44.   {
  45.     echo "<p>".__('No upcomming events.','ec3')."</p>\n";
  46.   }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement