Beispiel #1
0
/**
 * Each day in the calendar grid view will only display posts_per_page events.
 * Each event will have a tooltip for more information on that event.
 */
function display_day($day, $monthView)
{
    global $post;
    $output = '';
    $posts_per_page = get_option('posts_per_page');
    for ($i = 0; $i < count($monthView[$day]) && $i < $posts_per_page; $i++) {
        $post = $monthView[$day][$i];
        setup_postdata($post);
        $eventId = $post->ID . '-' . $day;
        $start = the_event_start_date($post->ID);
        $end = the_event_end_date($post->ID);
        $cost = the_event_cost($post->ID);
        $address = the_event_address($post->ID);
        $city = the_event_city($post->ID);
        $state = the_event_state($post->ID);
        $province = the_event_province($post->ID);
        $country = the_event_country($post->ID);
        ?>
		<div id='event_<?php 
        echo $eventId;
        ?>
' class="tec-event 
		<?php 
        foreach (get_the_category() as $category) {
            echo 'cat_' . $category->cat_name . ' ';
        }
        ?>
		">
			<a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a>
			<div id='tooltip_<?php 
        echo $eventId;
        ?>
' class="tec-tooltip" style="display:none;">
				<h5 class="tec-event-title"><?php 
        the_title();
        ?>
</h5>
				<div class="tec-event-body">
					<?php 
        if (!the_event_all_day($post->ID)) {
            ?>
					<div class="tec-event-date">
						<?php 
            if (!empty($start)) {
                echo $start;
            }
            ?>
						<?php 
            if (!empty($end) && $start !== $end) {
                echo " – " . $end . '<br />';
            }
            ?>
					</div>
					<?php 
        }
        ?>
					<?php 
        echo The_Events_Calendar::truncate(get_the_content(), 30);
        ?>

				</div>
				<span class="tec-arrow"></span>
			</div>
		</div>
		<?php 
        if ($i < $posts_per_page - 1 && $i < count($monthView[$day]) - 1) {
            echo "<hr />";
        }
    }
}
Beispiel #2
0
 /**
  * Returns the state or province for US or non-US addresses
  *
  * @return string
  */
 function the_event_region($postId = null)
 {
     if ($postId === null || !is_numeric($postId)) {
         global $post;
         $postId = $post->ID;
     }
     if (get_post_meta($postId, '_EventCountry', true) == 'United States') {
         return the_event_state($postId);
     } else {
         return the_event_province($postId);
     }
 }