From 5be69ecb249b5460258db6f892bcdd75c64f5769 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 11 Apr 2016 00:04:24 +1000 Subject: [PATCH] Add filters to taxonomies and native editor to post types --- .../post-types/class-sp-admin-meta-boxes.php | 24 ---------------- .../class-sp-meta-box-calendar-editor.php | 24 ---------------- .../class-sp-meta-box-event-editor.php | 24 ---------------- .../class-sp-meta-box-list-editor.php | 24 ---------------- .../class-sp-meta-box-player-editor.php | 24 ---------------- .../class-sp-meta-box-staff-editor.php | 24 ---------------- .../class-sp-meta-box-table-editor.php | 24 ---------------- .../class-sp-meta-box-team-editor.php | 24 ---------------- includes/class-sp-post-types.php | 28 +++++++++---------- modules/sportspress-calendars.php | 8 +----- modules/sportspress-league-tables.php | 8 +----- modules/sportspress-player-lists.php | 8 +----- 12 files changed, 17 insertions(+), 227 deletions(-) delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-editor.php delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-event-editor.php delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-list-editor.php delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-player-editor.php delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-editor.php delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-table-editor.php delete mode 100644 includes/admin/post-types/meta-boxes/class-sp-meta-box-team-editor.php diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php index d68a1f11..0c45214f 100644 --- a/includes/admin/post-types/class-sp-admin-meta-boxes.php +++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php @@ -144,12 +144,6 @@ class SP_Admin_Meta_Boxes { 'context' => 'normal', 'priority' => 'high', ), - 'editor' => array( - 'title' => __( 'Article', 'sportspress' ), - 'output' => 'SP_Meta_Box_Event_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), ), 'sp_team' => array( 'details' => array( @@ -159,12 +153,6 @@ class SP_Admin_Meta_Boxes { 'context' => 'side', 'priority' => 'default', ), - 'editor' => array( - 'title' => __( 'Profile', 'sportspress' ), - 'output' => 'SP_Meta_Box_Team_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), 'staff' => array( 'title' => __( 'Staff', 'sportspress' ), 'save' => 'SP_Meta_Box_Team_Staff::save', @@ -208,12 +196,6 @@ class SP_Admin_Meta_Boxes { 'context' => 'normal', 'priority' => 'high', ), - 'editor' => array( - 'title' => __( 'Profile', 'sportspress' ), - 'output' => 'SP_Meta_Box_Player_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), ), 'sp_staff' => array( 'shortcode' => array( @@ -229,12 +211,6 @@ class SP_Admin_Meta_Boxes { 'context' => 'side', 'priority' => 'default', ), - 'editor' => array( - 'title' => __( 'Profile', 'sportspress' ), - 'output' => 'SP_Meta_Box_Staff_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), ), ); diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-editor.php deleted file mode 100644 index 02713614..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-editor.php deleted file mode 100644 index 45392883..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-editor.php deleted file mode 100644 index cf78af43..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-editor.php deleted file mode 100644 index 83466337..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-editor.php deleted file mode 100644 index c3d772c1..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-editor.php deleted file mode 100644 index 2bc8f349..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-editor.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-editor.php deleted file mode 100644 index 3277d13f..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-editor.php +++ /dev/null @@ -1,24 +0,0 @@ -post_content, 'content' ); - } -} \ No newline at end of file diff --git a/includes/class-sp-post-types.php b/includes/class-sp-post-types.php index ae6ad959..7a22e485 100644 --- a/includes/class-sp-post-types.php +++ b/includes/class-sp-post-types.php @@ -47,7 +47,7 @@ class SP_Post_types { 'search_items' => __( 'Search', 'sportspress' ), 'not_found' => __( 'No results found.', 'sportspress' ), ); - $args = array( + $args = apply_filters( 'sportspress_register_taxonomy_league', array( 'label' => __( 'Competitions', 'sportspress' ), 'labels' => $labels, 'public' => true, @@ -55,7 +55,7 @@ class SP_Post_types { 'show_tagcloud' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_league_slug', 'league' ) ), - ); + ) ); $object_types = apply_filters( 'sportspress_league_object_types', array( 'sp_event', 'sp_calendar', 'sp_team', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) ); register_taxonomy( 'sp_league', $object_types, $args ); foreach ( $object_types as $object_type ): @@ -78,7 +78,7 @@ class SP_Post_types { 'search_items' => __( 'Search', 'sportspress' ), 'not_found' => __( 'No results found.', 'sportspress' ), ); - $args = array( + $args = apply_filters( 'sportspress_register_taxonomy_season', array( 'label' => __( 'Seasons', 'sportspress' ), 'labels' => $labels, 'public' => true, @@ -86,7 +86,7 @@ class SP_Post_types { 'show_tagcloud' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_season_slug', 'season' ) ), - ); + ) ); $object_types = apply_filters( 'sportspress_season_object_types', array( 'sp_event', 'sp_calendar', 'sp_team', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) ); register_taxonomy( 'sp_season', $object_types, $args ); foreach ( $object_types as $object_type ): @@ -109,7 +109,7 @@ class SP_Post_types { 'search_items' => __( 'Search', 'sportspress' ), 'not_found' => __( 'No results found.', 'sportspress' ), ); - $args = array( + $args = apply_filters( 'sportspress_register_taxonomy_venue', array( 'label' => __( 'Venues', 'sportspress' ), 'labels' => $labels, 'public' => true, @@ -117,7 +117,7 @@ class SP_Post_types { 'show_tagcloud' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_venue_slug', 'venue' ) ), - ); + ) ); $object_types = apply_filters( 'sportspress_event_object_types', array( 'sp_event', 'sp_calendar', 'sp_team' ) ); register_taxonomy( 'sp_venue', $object_types, $args ); foreach ( $object_types as $object_type ): @@ -140,7 +140,7 @@ class SP_Post_types { 'search_items' => __( 'Search', 'sportspress' ), 'not_found' => __( 'No results found.', 'sportspress' ), ); - $args = array( + $args = apply_filters( 'sportspress_register_taxonomy_position', array( 'label' => __( 'Positions', 'sportspress' ), 'labels' => $labels, 'public' => true, @@ -148,7 +148,7 @@ class SP_Post_types { 'show_tagcloud' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_position_slug', 'position' ) ), - ); + ) ); $object_types = apply_filters( 'sportspress_position_object_types', array( 'sp_player', 'sp_list' ) ); register_taxonomy( 'sp_position', $object_types, $args ); foreach ( $object_types as $object_type ): @@ -171,7 +171,7 @@ class SP_Post_types { 'search_items' => __( 'Search', 'sportspress' ), 'not_found' => __( 'No results found.', 'sportspress' ), ); - $args = array( + $args = apply_filters( 'sportspress_register_taxonomy_role', array( 'label' => __( 'Jobs', 'sportspress' ), 'labels' => $labels, 'public' => true, @@ -179,7 +179,7 @@ class SP_Post_types { 'show_tagcloud' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_role_slug', 'role' ) ), - ); + ) ); $object_types = apply_filters( 'sportspress_role_object_types', array( 'sp_staff' ) ); register_taxonomy( 'sp_role', $object_types, $args ); foreach ( $object_types as $object_type ): @@ -398,7 +398,7 @@ class SP_Post_types { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_event_slug', 'event' ) ), - 'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ), + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-calendar', @@ -432,7 +432,7 @@ class SP_Post_types { 'exclude_from_search' => false, 'hierarchical' => true, 'rewrite' => array( 'slug' => get_option( 'sportspress_team_slug', 'team' ) ), - 'supports' => array( 'title', 'author', 'thumbnail', 'page-attributes', 'excerpt' ), + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'excerpt' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-shield-alt', @@ -462,7 +462,7 @@ class SP_Post_types { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_player_slug', 'player' ) ), - 'supports' => array( 'title', 'author', 'thumbnail', 'excerpt', 'page-attributes' ), + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-groups', @@ -492,7 +492,7 @@ class SP_Post_types { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_staff_slug', 'staff' ) ), - 'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ), + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'menu_icon' => 'dashicons-businessman', diff --git a/modules/sportspress-calendars.php b/modules/sportspress-calendars.php index 3d4f39aa..9eafe38f 100644 --- a/modules/sportspress-calendars.php +++ b/modules/sportspress-calendars.php @@ -82,7 +82,7 @@ class SportsPress_Calendars { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_calendar_slug', 'calendar' ) ), - 'supports' => array( 'title', 'author', 'thumbnail' ), + 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'show_in_menu' => 'edit.php?post_type=sp_event', @@ -159,12 +159,6 @@ class SportsPress_Calendars { 'context' => 'normal', 'priority' => 'high', ), - 'editor' => array( - 'title' => __( 'Description', 'sportspress' ), - 'output' => 'SP_Meta_Box_Calendar_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), ); return $meta_boxes; } diff --git a/modules/sportspress-league-tables.php b/modules/sportspress-league-tables.php index f1165a5a..c9b88714 100644 --- a/modules/sportspress-league-tables.php +++ b/modules/sportspress-league-tables.php @@ -82,7 +82,7 @@ class SportsPress_League_Tables { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_table_slug', 'table' ) ), - 'supports' => array( 'title', 'page-attributes', 'thumbnail' ), + 'supports' => array( 'title', 'editor', 'page-attributes', 'thumbnail' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'show_in_menu' => 'edit.php?post_type=sp_team', @@ -159,12 +159,6 @@ class SportsPress_League_Tables { 'context' => 'normal', 'priority' => 'high', ), - 'editor' => array( - 'title' => __( 'Description', 'sportspress' ), - 'output' => 'SP_Meta_Box_Table_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), ); return $meta_boxes; } diff --git a/modules/sportspress-player-lists.php b/modules/sportspress-player-lists.php index 49bcbf01..4012587f 100644 --- a/modules/sportspress-player-lists.php +++ b/modules/sportspress-player-lists.php @@ -81,7 +81,7 @@ class SportsPress_Player_Lists { 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => get_option( 'sportspress_list_slug', 'list' ) ), - 'supports' => array( 'title', 'page-attributes', 'author', 'thumbnail' ), + 'supports' => array( 'title', 'editor', 'page-attributes', 'author', 'thumbnail' ), 'has_archive' => false, 'show_in_nav_menus' => true, 'show_in_menu' => 'edit.php?post_type=sp_player', @@ -165,12 +165,6 @@ class SportsPress_Player_Lists { 'context' => 'normal', 'priority' => 'high', ), - 'editor' => array( - 'title' => __( 'Description', 'sportspress' ), - 'output' => 'SP_Meta_Box_List_Editor::output', - 'context' => 'normal', - 'priority' => 'low', - ), ); return $meta_boxes; }