Add League Table widget and display future events
This commit is contained in:
17
admin/hooks/the-posts.php
Normal file
17
admin/hooks/the-posts.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
function sportspress_the_posts( $posts ) {
|
||||
global $wp_query, $wpdb;
|
||||
if( is_single() && $wp_query->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 );
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Register all of the default WordPress widgets on startup.
|
||||
*
|
||||
* Calls 'widgets_init' action after all of the WordPress widgets have been
|
||||
* registered.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
function sportspress_widgets_init() {
|
||||
|
||||
register_widget('SportsPress_Widget_Calendar');
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'sportspress_widgets_init', 1);
|
||||
Reference in New Issue
Block a user