Permalink
Browse files

no widget if no events

  • Loading branch information...
MattReimer committed Mar 20, 2012
1 parent 81e88e2 commit 2db0aed6c6d29b4af0cc3220c62f71ae4a4504e5
Showing with 10 additions and 8 deletions.
  1. +10 −8 re-events-widget.php
View
@@ -13,12 +13,8 @@ function __construct() {
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
- echo $before_widget;
- if ( $title )
- echo $before_title . $title . $after_title; ?>
-
- <?php $args = array(
+ $args = array(
'post_type' => 'tf_events',
'posts_per_page' => 0,
'meta_query' => array(
@@ -33,7 +29,12 @@ function widget( $args, $instance ) {
$loop = new WP_Query( $args ); ?>
<?php if ( $loop->have_posts() ) {
- ?><div class="row">
+
+ echo $before_widget;
+ if ( $title )
+ echo $before_title . $title . $after_title;
+
+ ?><div id="events-list" class="row">
<div class="twelve columns"><?php
while ( $loop->have_posts() ) {
@@ -55,11 +56,12 @@ function widget( $args, $instance ) {
</div>
</div>
<?php
+ echo $after_widget;
+
}//if ?>
- <?php echo $after_widget;
- }
+ <?php }
/** @see WP_Widget::update */
function update( $new_instance, $old_instance ) {

0 comments on commit 2db0aed

Please sign in to comment.