/**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        global $dd_sn;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        /* Start - Widget Content */
        ?>
				<div class="events-calendar-wrapper">
					<div class="events-calendar-wrapper-inner">
						<?php 
        dd_get_calendar(array('dd_events'), false, true);
        ?>
					</div>
				</div>
			<?php 
        /* End - Widget Content */
        echo $after_widget;
    }
Beispiel #2
0
    /**
     * Home section - Events
     *
     * Output contents for the section on the homepage.
     */
    function dd_home_section_events($atts)
    {
        global $dd_sn;
        $wrapper_class = '';
        // Wrapper classes
        if ($atts['parity'] == 'even') {
            $wrapper_class .= 'even ';
        } else {
            $wrapper_class .= 'odd ';
        }
        $args = array('post_type' => 'dd_events', 'posts_per_page' => ot_get_option($dd_sn . 'home_events_amount', '100'), 'post_status' => array('future', 'publish'), 'order' => 'ASC');
        $dd_query = new WP_Query($args);
        if ($dd_query->have_posts()) {
            $start_at = true;
            ?>

			<div class="events-wrapper home-section <?php 
            echo $wrapper_class;
            ?>
">

				<div class="container clearfix">

					<h2 class="section-title">
						<?php 
            if (!empty($atts['title'])) {
                ?>
							<span class="dd-button medium blue"><?php 
                echo $atts['title'];
                ?>
</span>
						<?php 
            }
            ?>
						<a href="<?php 
            echo get_permalink(dd_get_post_id('template', 'template-dd_events.php'));
            ?>
" class="dd-button medium orange-light"><?php 
            _e('VIEW ALL', 'dd_string');
            ?>
</a>
						<span class="carousel-nav fr">
							<span class="carousel-nav-inner">
								<a href="#" class="carousel-prev"></a>
								<a href="#" class="carousel-next"></a>
							</span>
						</span><!-- .carousel-nav -->
					</h2>

					<div class="events-calendar-wrapper one-third column">
						<div class="events-calendar-wrapper-inner">
							<?php 
            dd_get_calendar(array('dd_events'), false);
            ?>
						</div><!-- .events-calendar-wrapper-inner -->
					</div><!-- .one-third -->

					<div class="events carousel clearfix two-thirds column last"  data-autoplay="<?php 
            echo $atts['autoplay'];
            ?>
">

						<div class="flexslider">

							<ul class="slides">

								 <?php 
            $start_at = true;
            while ($dd_query->have_posts()) {
                $dd_query->the_post();
                ?>

								 	<?php 
                if (has_post_thumbnail()) {
                    $post_class_append = 'has-thumb ';
                } else {
                    $post_class_append = '';
                }
                $fb_link = get_post_meta(get_the_ID(), $dd_sn . 'event_facebook_link', true);
                // Date of event
                $event_date = get_post_meta(get_the_ID(), $dd_sn . 'event_date', true);
                if (!$event_date) {
                    $event_date = get_the_time(get_option('date_format'));
                }
                $start_at_class = '';
                if ($start_at && get_post_status(get_the_ID()) == 'future') {
                    $start_at = false;
                    $start_at_class = 'start-at';
                }
                ?>

									<li class="event one-third column <?php 
                echo $post_class_append . $start_at_class;
                ?>
" data-day="<?php 
                the_time('j m Y');
                ?>
">

										<div class="event-inner">

											<div class="event-thumb">

												<a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail('dd-home-events');
                ?>
</a>

												<div class="event-date"><span class="icon-calendar"></span><?php 
                echo $event_date;
                ?>
</div>

											</div><!-- .event-thumb -->

											<div class="event-main">

												<h2 class="event-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
													
												<div class="event-excerpt">
													<?php 
                the_excerpt();
                ?>
												</div><!-- .event-excerpt -->

											</div><!-- .event-main -->

											<div class="event-info">
												
												<a href="<?php 
                the_permalink();
                ?>
" class="dd-button small orange-light"><?php 
                _e('MORE DETAILS', 'dd_string');
                ?>
</a>
												
												<?php 
                if ($fb_link != '') {
                    ?>
													<em><?php 
                    _e('or', 'dd_string');
                    ?>
</em>
													<a href="<?php 
                    echo $fb_link;
                    ?>
" target="_blank" class="dd-button small blue-light"><?php 
                    _e('VIEW FACEBOOK PAGE', 'dd_string');
                    ?>
</a>
												<?php 
                }
                ?>

											</div><!-- event-info -->

										</div><!-- .event-inner -->

									</li><!-- .event -->

								<?php 
            }
            ?>

							</ul><!-- .slides -->

						</div><!-- .flexslider -->

					</div><!-- .blog-posts -->

				</div><!-- .container -->

			</div><!-- .events-wrapper -->
			
		<?php 
        }
        wp_reset_postdata();
    }