diff --git a/admin/hooks/the-posts.php b/admin/hooks/the-posts.php new file mode 100644 index 00000000..46d21110 --- /dev/null +++ b/admin/hooks/the-posts.php @@ -0,0 +1,17 @@ +post_count == 0 && isset( $wp_query->query_vars['sp_event'] ) ) { + $posts = $wpdb->get_results( $wp_query->request ); + } + return $posts; +} +//add_filter( 'the_posts', 'sportspress_the_posts' ); + +function sportspress_posts_where( $where, $that ) { + global $wpdb; + if( 'sp_event' == $that->query_vars['post_type'] && is_archive() ) + $where = str_replace( "{$wpdb->posts}.post_status = 'publish'", "{$wpdb->posts}.post_status = 'publish' OR $wpdb->posts.post_status = 'future'", $where ); + return $where; +} +add_filter( 'posts_where', 'sportspress_posts_where', 2, 10 ); diff --git a/admin/hooks/widgets-init.php b/admin/hooks/widgets-init.php deleted file mode 100644 index d864d2e2..00000000 --- a/admin/hooks/widgets-init.php +++ /dev/null @@ -1,15 +0,0 @@ -'; if ( $previous ) { - $calendar_output .= "\n\t\t".'
+
'widget_league_table widget_sp_league_table', 'description' => __( 'SportsPress widget.', 'sportspress' ) ); + parent::__construct('sp_table', __( 'League Table', 'sportspress', 'sportspress' ), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); + $id = empty($instance['id']) ? null : $instance['id']; + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + echo '
+
+ ++ 'sp_table', + 'name' => $this->get_field_name('id'), + 'id' => $this->get_field_id('id'), + 'show_option_none' => __( '-- Select --', 'sportspress' ), + 'selected' => $id, + 'values' => 'ID', + ); + sportspress_dropdown_pages( $args ); + ?> +
+