Exemplo n.º 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 />";
        }
    }
}
<li class="<?php 
echo $alt_text;
?>
">
	<div class="when">
		<?php 
if ($start == 'on' && $EventStartDate != '') {
    $time = $startTime == 'on' ? true : false;
    echo the_event_start_date($post->ID, $time);
}
if ($end == 'on' && $EventEndDate != '') {
    if ($start == 'on' && $EventStartDate != '') {
        echo ' to ';
    }
    $time = $endTime == 'on' ? true : false;
    echo the_event_end_date($post->ID, $time);
}
?>
	</div>
	<div class="event">
		<a href="<?php 
echo get_permalink($post->ID);
?>
"><?php 
echo $post->post_title;
?>
</a>
	</div>
	<div class="loc"><?php 
$output = '';
if ($venue == 'on' && $EventVenue != '') {
Exemplo n.º 3
0
			</div>
			
			<ul class="meta" style="float:left">
				<?php 
        if (in_category('events')) {
            ?>
					<li><span class="meta">Start:</span>&nbsp;&nbsp;<?php 
            echo the_event_start_date();
            ?>
</li>				
					
					<?php 
            if (the_event_start_date() !== the_event_end_date()) {
                ?>
					<li><span class="meta">End:</span>&nbsp;&nbsp;<?php 
                echo the_event_end_date();
                ?>
</li>
					<?php 
            }
            ?>
					
					<?php 
            if (the_event_venue()) {
                ?>
					<li><span class="meta"><?php 
                echo the_event_venue();
                ?>
</span></li>
					<?php 
            }
/**
* Custom Query Shortcode
*
* Uses WordPress shortcode api to insert a custom query into contant areas with shortcode support.
* Format is [list-events] using standard WP_Query arguments [list-posts more=1 tag='tag' category_name='category' cat=cat_num gs_content=number]
* container_style to set the style attribute for container
* container_class to set the class attribute for container
*
* Currently accespet WP_Query values are:
* posts_per_page, tag, cat, category_name
*
* @since 1.0
* @echo string
*/
function the_events_shortcode($atts)
{
    global $wp_query, $posts, $post, $more, $spEvents;
    // Defaults
    $qs_query_arr = shortcode_atts(array('title_tag' => 'div', 'container_style' => false, 'container_class' => false, 'limit' => 5, 'category_name' => 'Events'), $atts);
    // Set the temporary variables so we can restore them later
    $more_temp = $more;
    $temp_query = fnbx_clone($wp_query);
    $temp_posts = $posts;
    $temp_post = fnbx_clone($post);
    $list_posts_container_defaults = array('tag_type' => 'open', 'tag' => 'div', 'class' => 'list-events-container', 'return' => true);
    if (isset($qs_query_arr['container_style'])) {
        $list_posts_container_defaults['style'] = $qs_query_arr['container_style'];
    }
    if (isset($qs_query_arr['container_class'])) {
        $list_posts_container_defaults['class'] .= ' ' . $qs_query_arr['container_class'];
    }
    $output = jacket_core_html_tag($list_posts_container_defaults);
    if (function_exists('get_events')) {
        $old_display = $wp_query->get('eventDisplay');
        $wp_query->set('eventDisplay', 'upcoming');
        $event_posts = get_events($qs_query_arr['limit'], $qs_query_arr['category_name']);
    }
    if ($event_posts) {
        /* Display list of events. */
        if (function_exists('get_events')) {
            $output .= jacket_core_html_tag(array('tag_type' => 'open', 'tag' => 'ul', 'class' => 'list-events-list', 'return' => true));
            foreach ($event_posts as $event_post) {
                setup_postdata($event_post);
                $output .= jacket_core_html_tag(array('tag' => 'li', 'tag_type' => 'open', 'class' => 'list-events-item', 'return' => true));
                $temp_title = get_the_title($event_post->ID);
                $entry_title_link = jacket_core_html_tag(array('tag' => 'a', 'class' => 'permalink', 'title' => $temp_title, 'href' => get_permalink($event_post->ID), 'tag_content' => $temp_title, 'return' => true));
                $output .= jacket_core_html_tag(array('tag' => $qs_query_arr['title_tag'], 'class' => 'list-events-item-title', 'tag_content' => $entry_title_link, 'return' => true));
                $the_event = the_events_abbr($event_post->ID, '_EventStartDate', the_event_start_date($event_post->ID), 'date-start');
                if (!the_event_all_day($post->ID)) {
                    $the_event .= ' to ' . the_events_abbr($event_post->ID, '_EventEndDate', the_event_end_date($event_post->ID), 'date-end');
                }
                $output .= jacket_core_html_tag(array('tag' => 'div', 'class' => 'list-events-item-event', 'tag_content' => $the_event, 'return' => true));
                $output .= jacket_core_html_tag(array('tag' => 'li', 'tag_type' => 'close', 'return' => true));
            }
            $output .= jacket_core_html_tag(array('tag' => 'ul', 'tag_type' => 'close', 'return' => true));
            if (eventsGetOptionValue('viewOption') == 'upcoming') {
                $event_url = events_get_listview_link();
            } else {
                $event_url = events_get_gridview_link();
            }
            $events_link = jacket_core_html_tag(array('tag' => 'a', 'class' => 'link-events', 'title' => 'Vew All Events', 'href' => $event_url, 'tag_content' => 'Vew All Events', 'return' => true));
            $output .= jacket_core_html_tag(array('tag' => 'div', 'class' => 'list-events-link-events', 'tag_content' => $events_link, 'return' => true));
        }
    }
    $wp_query->set('eventDisplay', $old_display);
    $output .= jacket_core_html_tag(array('tag' => 'div', 'tag_type' => 'close', 'return' => true));
    // Reset the temporary variables so we can restore them later
    $more = $more_temp;
    $wp_query = fnbx_clone($temp_query);
    $posts = $temp_posts;
    $post = fnbx_clone($temp_post);
    wp_reset_query();
    wp_reset_postdata();
    return $output;
}