Conditional Functions

Migration to module
This commit is contained in:
savvasha
2018-02-27 21:35:31 +02:00
parent 9db32d4d3d
commit f447694a59
2 changed files with 7 additions and 1 deletions

View File

@@ -78,7 +78,7 @@ if ( ! function_exists( 'sp_importable_post_types' ) ) {
*/ */
if ( ! function_exists( 'sp_config_types' ) ) { if ( ! function_exists( 'sp_config_types' ) ) {
function sp_config_types() { function sp_config_types() {
return apply_filters( 'sportspress_config_types', array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric', 'sp_spec', 'sp_statistic' ) ); return apply_filters( 'sportspress_config_types', array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric', 'sp_statistic' ) );
} }
} }

View File

@@ -36,6 +36,7 @@ class SportsPress_Event_Specs {
// Filters // Filters
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) ); add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
add_filter( 'sportspress_screen_ids', array( $this, 'screen_ids' ) ); add_filter( 'sportspress_screen_ids', array( $this, 'screen_ids' ) );
add_filter( 'sportspress_config_types', array( $this, 'add_post_type' ) );
} }
/** /**
@@ -99,6 +100,11 @@ class SportsPress_Event_Specs {
) ); ) );
} }
public static function add_post_type( $post_types = array() ) {
$post_types[] = 'sp_spec';
return $post_types;
}
/** /**
* Conditonally load the class and functions only needed when viewing this post type. * Conditonally load the class and functions only needed when viewing this post type.
*/ */