コード例 #1
0
ファイル: table.php プロジェクト: hypenotic/slowfood
/**
 * 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 />";
        }
    }
}
コード例 #2
0
ファイル: template-tags.php プロジェクト: hypenotic/slowfood
 /**
  * @return boolean true if any part of an address exists
  */
 function tec_address_exists($postId = null)
 {
     if ($postId === null || !is_numeric($postId)) {
         global $post;
         $postId = $post->ID;
     }
     return the_event_address($postId) || the_event_city($postId) || the_event_region($postId) || the_event_country($postId) || the_event_zip($postId) ? true : false;
 }