diff --git a/liveblog.php b/liveblog.php index 44bc4c130..e9a270fe7 100644 --- a/liveblog.php +++ b/liveblog.php @@ -59,6 +59,7 @@ final class WPCOM_Liveblog { public static $auto_archive_days = null; public static $auto_archive_expiry_key = 'liveblog_autoarchive_expiry_date'; public static $latest_timestamp = false; + public static $supported_post_types = array(); /** Load Methods **********************************************************/ @@ -250,7 +251,20 @@ public static function init() { * Add liveblog support to the 'post' post type. This is done here so * we can possibly introduce this to other post types later. */ - add_post_type_support( 'post', self::KEY ); + $post_types = array( 'post' ); + + /** + * Filters post types supported by this plugin. + * + * @since 2.0.0 + * + * @param array Supported post types. + */ + self::$supported_post_types = apply_filters( 'liveblog_supported_post_types', $post_types ); + + foreach ( self::$supported_post_types as $post_type ) { + add_post_type_support( $post_type, self::KEY ); + } /** * Apply a Filter to Setup our Auto Archive Days. @@ -493,14 +507,14 @@ public static function is_liveblog_post( $post_id = null ) { * @return bool */ public static function is_viewing_liveblog_post() { - return (bool) ( is_single() && self::is_liveblog_post() ); + return (bool) ( is_singular( self::$supported_post_types ) && self::is_liveblog_post() ); } /** * One of: 'enable', 'archive', false. */ public static function get_liveblog_state( $post_id = null ) { - if ( ! is_single() && ! is_admin() && ! self::$is_rest_api_call ) { + if ( ! is_singular( self::$supported_post_types ) && ! is_admin() && ! self::$is_rest_api_call ) { return false; } if ( empty( $post_id ) ) {