/** * 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) { $color_scheme = isset($instance['color_scheme']) ? $instance['color_scheme'] : 'light'; $column = isset($instance['column']) ? absint($instance['column']) : 2; echo $args['before_widget']; ?> <div class="section <?php echo $color_scheme; ?> -scheme"> <div class="container"> <div class="title"><?php echo $instance['title']; ?> </div> <div class="row"> <?php $the_query = new WP_Query(array('post_type' => 'event')); if ($the_query->have_posts()) { echo '<div class="grid-loop js-isotope-grid list-event">'; while ($the_query->have_posts()) { $the_query->the_post(); ?> <div id="event-grid-<?php the_ID(); ?> " <?php post_class('event-grid-post col-md-' . 12 / $column . ' col-sm-6 '); ?> > <div class="event-grid-post-wrapper"> <?php if (has_post_thumbnail()) { ?> <div class="event-grid-post-thumbnail"> <a href="<?php the_permalink(); ?> "> <img src="<?php echo ld_aq_resize(get_post_thumbnail_id(), 570, null, true, true); ?> " alt="<?php echo esc_attr(get_the_title()); ?> " /> </a> </div> <?php } ?> <h4 class="event-grid-post-title heading"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <div class="event-grid-excerpt"><?php the_excerpt(); ?> </div> <div class="event-meta"> <?php $event_date = strtotime(ld_event_option('event_date')); if (!empty($event_date)) { echo '<div class="event-meta-date"><i class="li_calendar"></i>' . date_i18n($instance['dateformat'], $event_date) . '</div>'; } $event_time = ld_event_option('event_time'); if (!empty($event_time)) { echo '<div class="event-meta-time"><i class="li_clock"></i>' . $event_time . '</div>'; } $event_venue = ld_event_option('event_venue'); if (!empty($event_venue)) { echo '<div class="event-meta-venue"><i class="li_shop"></i>' . $event_venue . '</div>'; } $event_address = ld_event_option('event_address'); if (!empty($event_address)) { echo '<div class="event-meta-address"><i class="li_location"></i>' . $event_address . '</div>'; } ?> </div> <div class="event-detail-link"><a href="<?php echo get_permalink(); ?> " class="button heading"><?php _e('Ver Mais Detalhes', 'lovey_dovey'); ?> </a></div> </div> </div> <?php } echo '</div>'; } else { // no posts found } /* Restore original Post Data */ wp_reset_postdata(); ?> </div> </div> </div> <?php echo $args['after_widget']; }
} else { $a = ''; $b = 'col-md-8 col-md-offset-2'; } ?> <?php if (has_post_thumbnail()) { ?> <div class="<?php echo $a; ?> "> <div class="page-thumbnail"> <img src="<?php echo ld_aq_resize(get_post_thumbnail_id(), 340, 0, true, true); ?> " alt="<?php echo esc_attr(get_the_title()); ?> " /> </div> </div> <?php } ?> <div class="<?php echo $b; ?> "> <article id="page-<?php
?> " <?php post_class(); ?> > <?php $event_map = ld_event_option('event_map'); ?> <?php if (has_post_thumbnail()) { ?> <div class="event-thumbnail"> <img src="<?php echo ld_aq_resize(get_post_thumbnail_id(), 1140, 712, true, true); ?> " alt="<?php echo esc_attr(get_the_title()); ?> " /> </div> <?php } ?> <div class="event-detail"> <div class="event-content"> <?php the_content(); ?>
?> " <?php post_class(''); ?> > <h2 class="page-title"><?php echo the_title(); ?> </h2> <?php if (has_post_thumbnail()) { ?> <div class="page-thumbnail"> <img src="<?php echo ld_aq_resize(get_post_thumbnail_id(), 800, 450, true, true); ?> " alt="<?php echo esc_attr(get_the_title()); ?> " /> </div> <?php } ?> <div class="page-content"> <?php the_content(); ?> </div> </article>
/** * 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) { $title = isset($instance['title']) ? $instance['title'] : __('Recent Blog Posts', 'lovey_dovey'); $number = isset($instance['number']) ? absint($instance['number']) : 3; $column = isset($instance['column']) ? absint($instance['column']) : 3; $color_scheme = isset($instance['color_scheme']) ? $instance['color_scheme'] : 'light'; global $wp_query; $temp = $wp_query; $wp_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1)); echo $args['before_widget']; ?> <div class="section <?php echo $color_scheme; ?> -scheme"> <div class="container"> <div class="title"><?php echo $title; ?> </div> <div class="grid-loop js-isotope-grid"> <?php while (have_posts()) { the_post(); ?> <div id="blog-grid-<?php the_ID(); ?> " <?php post_class('blog-grid-post col-md-' . 12 / $column . ' col-sm-6 '); ?> > <div class="blog-grid-post-wrapper"> <?php if (has_post_thumbnail()) { ?> <div class="blog-grid-post-thumbnail"> <a href="<?php the_permalink(); ?> "> <img src="<?php echo ld_aq_resize(get_post_thumbnail_id(), 570, null, true, true); ?> " alt="<?php echo esc_attr(get_the_title()); ?> " /> </a> </div> <?php } ?> <h4 class="blog-grid-post-title heading"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <div class="blog-grid-post-content"><?php the_excerpt(); ?> </div> <small class="blog-grid-post-date-and-author"><?php echo get_the_date(); echo ' by '; echo the_author_posts_link(); ?> </small> </div> </div> <?php } ?> </div> </div> </div> <?php echo $args['after_widget']; $wp_query = $temp; wp_reset_postdata(); }