Add comment support to Teams/Clubs pages

This commit is contained in:
savvasha
2019-08-12 13:00:03 +03:00
parent a38facdeb2
commit 62888f5371
2 changed files with 16 additions and 6 deletions

View File

@@ -81,6 +81,14 @@ class SP_Settings_Teams extends SP_Settings_Page {
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Comments', 'sportspress' ),
'desc' => __( 'Allow people to post comments on Team page', 'sportspress' ),
'id' => 'sportspress_team_comment_status',
'default' => 'no',
'type' => 'checkbox',
),
)),
array(

View File

@@ -447,9 +447,7 @@ class SP_Post_types {
register_post_type( 'sp_event', apply_filters( 'sportspress_register_post_type_event', $args ) );
register_post_type( 'sp_team',
apply_filters( 'sportspress_register_post_type_team',
array(
$args = array(
'labels' => array(
'name' => __( 'Teams', 'sportspress' ),
'singular_name' => __( 'Team', 'sportspress' ),
@@ -480,9 +478,13 @@ class SP_Post_types {
'show_in_rest' => true,
'rest_controller_class' => 'SP_REST_Posts_Controller',
'rest_base' => 'teams',
)
)
);
);
if ( get_option( 'sportspress_team_comment_status', 'no' ) == 'yes' ):
$args[ 'supports' ][] = 'comments';
endif;
register_post_type( 'sp_team', apply_filters( 'sportspress_register_post_type_team', $args ) );
register_post_type( 'sp_player',
apply_filters( 'sportspress_register_post_type_player',