diff --git a/.gitignore b/.gitignore index ffc36524..cea7b18d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,7 @@ sitemap.xml wp-content/cache/ wp-content/backups/ sitemap.xml -sitemap.xml.gz \ No newline at end of file +sitemap.xml.gz +.DS_STORE +psd/ +demo/ \ No newline at end of file diff --git a/calendar.php b/calendar.php new file mode 100644 index 00000000..09d090dc --- /dev/null +++ b/calendar.php @@ -0,0 +1,77 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => false, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'calendar' ), + ); + register_post_type( 'sp_calendar', $args ); +} +add_action( 'init', 'sp_calendar_cpt_init' ); + +function sp_calendar_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'title' => __( 'Title' ), + 'sp_team' => __( 'Teams', 'sportspress' ), + 'sp_league' => __( 'League', 'sportspress' ), + 'sp_season' => __( 'Season', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_calendar_columns', 'sp_calendar_edit_columns' ); + +function sp_calendar_custom_columns( $column ) { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_calendar' ): + switch ($column): + case 'sp_team': + echo 'TEAMS'; + break; + case 'sp_league': + the_terms( $post_id, 'sp_league' ); + break; + case 'sp_season': + the_terms( $post_id, 'sp_season' ); + break; + endswitch; + endif; +} +add_action( 'manage_posts_custom_column', 'sp_calendar_custom_columns' ); + +function sp_calendar_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_calendar' ) { + + // Leagues + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Seasons + $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_season', + 'name' => 'sp_season', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + } +} +add_action( 'restrict_manage_posts', 'sp_calendar_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/defaults.php b/defaults.php new file mode 100644 index 00000000..117870a5 --- /dev/null +++ b/defaults.php @@ -0,0 +1,14 @@ + array( + 'sp_event_team_count' => 2, + ), +); + +foreach( $sp_options as $optiongroupkey => $optiongroup ) { + foreach( $optiongroup as $key => $value ) { + if ( get_option( $key ) === false ) + update_option( $key, $value ); + } +} +?> \ No newline at end of file diff --git a/event.php b/event.php new file mode 100644 index 00000000..fc201f10 --- /dev/null +++ b/event.php @@ -0,0 +1,319 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => false, + 'supports' => array( 'title', 'author', 'comments', 'page-attributes' ), + 'register_meta_box_cb' => 'sp_event_meta_init', + 'rewrite' => array( 'slug' => 'event' ), + ); + register_post_type( 'sp_event', $args ); +} +add_action( 'init', 'sp_event_cpt_init' ); + +function sp_event_display_scheduled( $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', 'sp_event_display_scheduled' ); + +function sp_event_text_replace( $input, $text, $domain ) { + global $post; + if ( is_admin() && get_post_type( $post ) == 'sp_event' ) + switch ( $text ): + case 'Scheduled for: %1$s': + return __( 'Kick-off: %1$s', 'sportspress' ); + break; + case 'Published on: %1$s': + return __( 'Kick-off: %1$s', 'sportspress' ); + break; + case 'Publish immediately': + return __( 'Kick-off: %1$s', 'sportspress' ); + break; + default: + return $input; + endswitch; + return $input; +} +add_filter( 'gettext', 'sp_event_text_replace', 20, 3 ); + +function sp_event_meta_init() { + add_meta_box( + 'sp_teamdiv', + __( 'Teams', 'sportspress' ), + 'sp_event_team_meta', + 'sp_event', + 'normal', + 'high' + ); + add_meta_box( + 'sp_articlediv', + __( 'Article', 'sportspress' ), + 'sp_event_article_meta', + 'sp_event', + 'normal', + 'high' + ); +} + +function sp_event_team_meta( $post, $metabox ) { + global $post_id; + $limit = get_option( 'sp_event_team_count' ); + for ( $i = 1; $i <= $limit; $i++ ): + $args = array( + 'post_type' => 'sp_team', + 'name' => 'sportspress[sp_team_' . $i . ']', + 'selected' => get_post_meta( $post_id, 'sp_team_' . $i, true ), + ); + echo '' . PHP_EOL; + wp_dropdown_pages( $args ); + /* + $players = unserialize( get_post_meta( $post_id, 'sp_players', true ) ); + ?> +
+ +
+ +
+ +
+
+

+ +
+ +
+ +
+
+ + '; +} + +function sp_event_article_meta( $post, $metabox ) { + wp_editor( $post->post_content, 'content' ); +} + +function sp_event_save() { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_event' && isset( $_POST ) ) { + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; + if ( ! isset( $_POST['sp_event_team_nonce'] ) || ! wp_verify_nonce( $_POST['sp_event_team_nonce'], plugin_basename( __FILE__ ) ) ) return $post_id; + $sportspress = (array)$_POST['sportspress']; + foreach ( $sportspress as $key => $value ): + update_post_meta( $post_id, $key, $value ); + endforeach; + } +} +add_action( 'save_post', 'sp_event_save' ); + +function sp_event_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'title' => __( 'Event', 'sportspress' ), + 'sp_team' => __( 'Teams', 'sportspress' ), + 'sp_league' => __( 'League', 'sportspress' ), + 'sp_season' => __( 'Season', 'sportspress' ), + 'sp_sponsor' => __( 'Sponsor', 'sportspress' ), + 'sp_kickoff' => __( 'Kick-off', 'sportspress' ), + 'date' => __( 'Date' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_event_columns', 'sp_event_edit_columns' ); + +function sp_event_custom_columns( $column, $post_id ) { + global $typenow; + if ( $typenow == 'sp_event' ): + switch ( $column ): + case 'sp_team': + $limit = get_option( 'sp_event_team_count' ); + for ( $i = 1; $i <= $limit; $i++ ): + $team = get_post_meta( $post_id, 'sp_team_' . $i, true ); + edit_post_link( get_the_title( $team ), '', '
', $team ); + endfor; + break; + case 'sp_league': + the_terms( $post_id, 'sp_league' ); + break; + case 'sp_season': + the_terms( $post_id, 'sp_season' ); + break; + case 'sp_sponsor': + the_terms( $post_id, 'sp_sponsor' ); + break; + case 'sp_kickoff': + echo get_the_time ( get_option ( 'time_format' ) ); + break; + case 'date': + echo get_the_date ( get_option ( 'date_format' ) ); + break; + endswitch; + endif; +} +add_action( 'manage_posts_custom_column', 'sp_event_custom_columns', 10, 2 ); + +/* +function sp_event_edit_sortable_columns( $columns ) { + $columns['sp_team'] = 'sp_team'; + return $columns; +} +add_filter( 'manage_edit-sp_event_sortable_columns', 'sp_event_edit_sortable_columns' ); + +function sp_event_column_sorting( $vars ) { + if( isset( $vars['orderby'] ) && 'sp_team' == $vars['orderby'] ){ + $vars = array_merge( $vars, array( + 'meta_key' => 'sp_team_1', + 'orderby' => 'meta_value' + ) ); + } + return $vars; +} +add_filter('requests', 'sp_event_column_sorting'); +*/ + +function sp_event_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_event' ) { + + // Leagues + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Seasons + $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_season', + 'name' => 'sp_season', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Sponsors + $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ), + 'taxonomy' => 'sp_sponsor', + 'name' => 'sp_sponsor', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + + } +} +add_action( 'restrict_manage_posts', 'sp_event_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/helpers.php b/helpers.php new file mode 100644 index 00000000..f3329ee5 --- /dev/null +++ b/helpers.php @@ -0,0 +1,85 @@ + $name, + 'singular_name' => $singular_name, + 'all_items' => sprintf( __( 'All %s', 'sportspress' ), $name ), + 'add_new_item' => sprintf( __( 'Add New %s', 'sportspress' ), $singular_name ), + 'edit_item' => sprintf( __( 'Edit %s', 'sportspress' ), $singular_name ), + 'new_item' => sprintf( __( 'New %s', 'sportspress' ), $singular_name ), + 'view_item' => sprintf( __( 'View %s', 'sportspress' ), $singular_name ), + 'search_items' => sprintf( __( 'Search %s', 'sportspress' ), $name ), + 'not_found' => sprintf( __( 'No %s found', 'sportspress' ), $name ), + 'not_found_in_trash' => sprintf( __( 'No %s found in trash', 'sportspress' ), $name ), + 'parent_item_colon' => sprintf( __( 'Parent %s:', 'sportspress' ), $singular_name ), + ); + return $labels; + } +} + +if ( ! function_exists( 'sp_get_tax_labels' ) ) { + function sp_get_tax_labels( $name, $singular_name ) { + $labels = array( + 'name' => __( $name, 'sportspress' ), + 'singular_name' => __( $singular_name, 'sportspress' ), + 'all_items' => sprintf( __( 'All %s', 'sportspress' ), __( $name, 'sportspress' ) ), + 'edit_item' => sprintf( __( 'Edit %s', 'sportspress' ), __( $singular_name, 'sportspress' ) ), + 'view_item' => sprintf( __( 'View %s', 'sportspress' ), __( $singular_name, 'sportspress' ) ), + 'update_item' => sprintf( __( 'Update %s', 'sportspress' ), __( $singular_name, 'sportspress' ) ), + 'add_new_item' => sprintf( __( 'Add New %s', 'sportspress' ), __( $singular_name, 'sportspress' ) ), + 'new_item_name' => __( $singular_name, 'sportspress' ), + 'parent_item' => sprintf( __( 'Parent %s', 'sportspress' ), __( $singular_name, 'sportspress' ) ), + 'parent_item_colon' => sprintf( __( 'Parent %s:', 'sportspress' ), __( $singular_name, 'sportspress' ) ), + 'search_items' => sprintf( __( 'Search %s', 'sportspress' ), __( $name, 'sportspress' ) ), + 'not_found' => sprintf( __( 'No %s found', 'sportspress' ), __( $name, 'sportspress' ) ), + ); + return $labels; + } +} + +if ( ! function_exists( 'sp_dropdown_taxonomies' ) ) { + function sp_dropdown_taxonomies( $args = array() ) { + $defaults = array( + 'show_option_all' => false, + 'show_option_none' => false, + 'taxonomy' => null, + 'name' => null, + 'selected' => null, + ); + $args = array_merge( $defaults, $args ); + $terms = get_terms( $args['taxonomy'] ); + $name = ( $args['name'] ) ? $args['name'] : $args['taxonomy']; + if ( $terms ) { + printf( '' ); + } + } + if ( ! function_exists( 'sp_team_logo' ) ) { + function sp_team_logo( $post_id = null ) { + if ( ! isset( $post_id ) ) + global $post_id; + if ( has_post_thumbnail( $post_id ) ): + the_post_thumbnail( 'sp_icon' ); + else: + $parents = get_post_ancestors( $post_id ); + foreach ( $parents as $parent ) { + if( has_post_thumbnail( $parent ) ) { + echo get_the_post_thumbnail( $parent, 'sp_icon'); + break; + } + } + endif; + } + } +} +?> \ No newline at end of file diff --git a/images/menu.png b/images/menu.png new file mode 100644 index 00000000..da3ac766 Binary files /dev/null and b/images/menu.png differ diff --git a/index.php b/index.php new file mode 100644 index 00000000..a6ce9c89 --- /dev/null +++ b/index.php @@ -0,0 +1,2 @@ +\n" +"Language-Team: ThemeBoy \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e;_x;_ex\n" +"X-Poedit-Basepath: .\n" +"X-Generator: Poedit 1.5.7\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-SearchPath-0: ..\n" + +#: ../calendar.php:3 +msgid "Calendars" +msgstr "カレンダー" + +#: ../calendar.php:4 +msgid "Calendar" +msgstr "カレンダー" + +#: ../calendar.php:21 ../table.php:21 +msgid "Title" +msgstr "タイトル" + +#: ../calendar.php:22 ../event.php:83 ../table.php:22 ../team.php:3 +msgid "Teams" +msgstr "チーム" + +#: ../calendar.php:23 ../event.php:84 ../league.php:4 ../player.php:24 +#: ../staff.php:24 ../table.php:23 ../team.php:42 +msgid "League" +msgstr "リーグ" + +#: ../calendar.php:24 ../event.php:85 ../player.php:25 ../season.php:4 +#: ../staff.php:25 ../table.php:24 ../team.php:43 +msgid "Season" +msgstr "シーズン" + +#: ../calendar.php:56 ../calendar.php:67 ../event.php:129 ../event.php:140 +#: ../event.php:151 ../helpers.php:7 ../helpers.php:26 ../player.php:61 +#: ../player.php:72 ../player.php:83 ../player.php:94 ../staff.php:57 +#: ../staff.php:68 ../staff.php:79 ../table.php:56 ../table.php:67 +#: ../team.php:76 ../team.php:87 ../team.php:98 +#, php-format +msgid "All %s" +msgstr "すべての%s" + +#: ../calendar.php:56 ../event.php:129 ../league.php:3 ../player.php:72 +#: ../staff.php:68 ../table.php:56 ../team.php:76 +msgid "Leagues" +msgstr "リーグ" + +#: ../calendar.php:67 ../event.php:140 ../player.php:83 ../season.php:3 +#: ../staff.php:79 ../table.php:67 ../team.php:87 +msgid "Seasons" +msgstr "シーズン" + +#: ../event.php:3 +msgid "Events" +msgstr "試合" + +#: ../event.php:4 ../event.php:82 +msgid "Event" +msgstr "試合" + +#: ../event.php:33 ../event.php:36 ../event.php:39 +#, php-format +msgid "Kick-off: %1$s" +msgstr "キックオフ: %1$s" + +#: ../event.php:52 ../player.php:23 ../staff.php:22 ../team.php:4 +#: ../team.php:41 +msgid "Team" +msgstr "チーム" + +#: ../event.php:62 +msgid "Article" +msgstr "記事" + +#: ../event.php:86 ../player.php:26 ../sponsor.php:4 ../team.php:44 +msgid "Sponsor" +msgstr "スポンサー" + +#: ../event.php:87 +msgid "Kick-off" +msgstr "キックオフ" + +#: ../event.php:88 +msgid "Date" +msgstr "日付" + +#: ../event.php:151 ../player.php:94 ../sponsor.php:3 ../team.php:98 +msgid "Sponsors" +msgstr "スポンサー" + +#: ../helpers.php:8 ../helpers.php:30 ../team.php:26 ../team.php:29 +#, php-format +msgid "Add New %s" +msgstr "新規%sを追加" + +#: ../helpers.php:9 ../helpers.php:27 +#, php-format +msgid "Edit %s" +msgstr "%sを編集" + +#: ../helpers.php:10 +#, php-format +msgid "New %s" +msgstr "新規%s" + +#: ../helpers.php:11 ../helpers.php:28 +#, php-format +msgid "View %s" +msgstr "%sを表示" + +#: ../helpers.php:12 ../helpers.php:34 +#, php-format +msgid "Search %s" +msgstr "%sを検索" + +#: ../helpers.php:13 ../helpers.php:35 +#, php-format +msgid "No %s found" +msgstr "%sは見つかりませんでした" + +#: ../helpers.php:14 +#, php-format +msgid "No %s found in trash" +msgstr "ゴミ箱内に%sは見つかりませんでした。" + +#: ../helpers.php:15 ../helpers.php:33 +#, php-format +msgid "Parent %s:" +msgstr "親%s:" + +#: ../helpers.php:29 +#, php-format +msgid "Update %s" +msgstr "%sを更新" + +#: ../helpers.php:32 +#, php-format +msgid "Parent %s" +msgstr "親%s" + +#: ../player.php:3 +msgid "Players" +msgstr "選手" + +#: ../player.php:4 +msgid "Player" +msgstr "選手" + +#: ../player.php:21 ../staff.php:21 +msgid "Name" +msgstr "名前" + +#: ../player.php:22 ../position.php:4 ../staff.php:23 +msgid "Position" +msgstr "ポジション" + +#: ../player.php:61 ../position.php:3 ../staff.php:57 +msgid "Positions" +msgstr "ポジション" + +#: ../staff.php:3 ../staff.php:4 +msgid "Staff" +msgstr "スタッフ" + +#: ../table.php:3 +msgid "Tables" +msgstr "順位表" + +#: ../table.php:4 +msgid "Table" +msgstr "順位表" + +#: ../team.php:23 ../team.php:26 ../team.php:29 +msgid "Logo" +msgstr "ロゴ" + +#: ../tournament.php:3 +msgid "Tournaments" +msgstr "大会" + +#: ../tournament.php:4 +msgid "Tournament" +msgstr "大会" + +#: ../venue.php:3 +msgid "Venues" +msgstr "会場" + +#: ../venue.php:4 +msgid "Venue" +msgstr "会場" + +#~ msgid "League Table" +#~ msgstr "順位表" diff --git a/league.php b/league.php new file mode 100644 index 00000000..04dd9dcb --- /dev/null +++ b/league.php @@ -0,0 +1,17 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => 'league' ), + ); + register_taxonomy( 'sp_league', $object_type, $args ); +} +add_action( 'init', 'sp_league_tax_init' ); +?> \ No newline at end of file diff --git a/player.php b/player.php new file mode 100644 index 00000000..a56b6ab4 --- /dev/null +++ b/player.php @@ -0,0 +1,107 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => false, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'player' ), + ); + register_post_type( 'sp_player', $args ); +} +add_action( 'init', 'sp_player_cpt_init' ); + +function sp_player_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'sp_icon' => ' ', + 'title' => __( 'Name', 'sportspress' ), + 'sp_position' => __( 'Position', 'sportspress' ), + 'sp_team' => __( 'Team', 'sportspress' ), + 'sp_league' => __( 'League', 'sportspress' ), + 'sp_season' => __( 'Season', 'sportspress' ), + 'sp_sponsor' => __( 'Sponsor', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_player_columns', 'sp_player_edit_columns' ); + +function sp_player_custom_columns( $column ) { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_player' ): + switch ($column): + case 'sp_icon': + if ( has_post_thumbnail() ) the_post_thumbnail( 'sp_icon' ); + break; + case 'sp_position': + the_terms( $post_id, 'sp_position' ); + break; + case 'sp_league': + the_terms( $post_id, 'sp_league' ); + break; + case 'sp_season': + the_terms( $post_id, 'sp_season' ); + break; + case 'sp_sponsor': + the_terms( $post_id, 'sp_sponsor' ); + break; + endswitch; + endif; +} +add_action( 'manage_posts_custom_column', 'sp_player_custom_columns' ); + +function sp_player_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_player' ) { + + // Positions + $selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), + 'taxonomy' => 'sp_position', + 'name' => 'sp_position', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Leagues + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Seasons + $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_season', + 'name' => 'sp_season', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Sponsors + $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ), + 'taxonomy' => 'sp_sponsor', + 'name' => 'sp_sponsor', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + + } +} +add_action( 'restrict_manage_posts', 'sp_player_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/position.php b/position.php new file mode 100644 index 00000000..b2934d00 --- /dev/null +++ b/position.php @@ -0,0 +1,17 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => 'position' ), + ); + register_taxonomy( 'sp_position', $object_type, $args ); +} +add_action( 'init', 'sp_position_tax_init' ); +?> \ No newline at end of file diff --git a/season.php b/season.php new file mode 100644 index 00000000..790e63c0 --- /dev/null +++ b/season.php @@ -0,0 +1,17 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => 'season' ), + ); + register_taxonomy( 'sp_season', $object_type, $args ); +} +add_action( 'init', 'sp_season_tax_init' ); +?> \ No newline at end of file diff --git a/settings.php b/settings.php new file mode 100644 index 00000000..aeb9f1c9 --- /dev/null +++ b/settings.php @@ -0,0 +1,113 @@ + +
+

+

+ $value ) { + $new_value = isset( $_POST[$option_field] ) ? $_POST[$option_field] : null; + update_option( $option_field, stripslashes( $new_value ) ); + } + ?> +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + 'tb_club', + 'limit' => -1, + 'show_option_none' => __( 'None' ), + 'selected' => get_option( $option_slug ), + 'name' => $option_slug, + 'id' => $option_slug + ) ); + ?> +
+ +
+ + + 'tb_sponsor', + 'limit' => -1, + 'show_option_none' => __( 'None' ), + 'selected' => get_option( $option_slug ), + 'name' => $option_slug, + 'id' => $option_slug + ) ); + ?>
+ + + 'tb_sponsor', + 'limit' => -1, + 'show_option_none' => __( 'None' ), + 'selected' => get_option( $option_slug ), + 'name' => $option_slug, + 'id' => $option_slug + ) ); + ?> +
+ + /> + +
+ + /> + +
+ + +
+
+ \ No newline at end of file diff --git a/sponsor.php b/sponsor.php new file mode 100644 index 00000000..cc3d8256 --- /dev/null +++ b/sponsor.php @@ -0,0 +1,17 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => 'sponsor' ), + ); + register_taxonomy( 'sp_sponsor', $object_type, $args ); +} +add_action( 'init', 'sp_sponsor_tax_init' ); +?> \ No newline at end of file diff --git a/sportspress-admin.css b/sportspress-admin.css new file mode 100644 index 00000000..f0ee922f --- /dev/null +++ b/sportspress-admin.css @@ -0,0 +1,103 @@ +#adminmenu #toplevel_page_sp_settings div.wp-menu-image, +#adminmenu #menu-posts-sp_team div.wp-menu-image, +#adminmenu #menu-posts-sp_event div.wp-menu-image, +#adminmenu #menu-posts-sp_player div.wp-menu-image, +#adminmenu #menu-posts-sp_staff div.wp-menu-image, +#adminmenu #menu-posts-sp_sponsor div.wp-menu-image, +#adminmenu #menu-posts-sp_table div.wp-menu-image, +#adminmenu #menu-posts-sp_calendar div.wp-menu-image, +#adminmenu #menu-posts-sp_tournament div.wp-menu-image, +#adminmenu #menu-posts-sp_venue div.wp-menu-image { + background-image: url(images/menu.png); + background-repeat: no-repeat; +} +#adminmenu #toplevel_page_sp_settings div.wp-menu-image { + background-position: 1px -33px; +} +#adminmenu #toplevel_page_sp_settings:hover div.wp-menu-image, +#adminmenu #toplevel_page_sp_settings.wp-has-current-submenu div.wp-menu-image, +#adminmenu #toplevel_page_sp_settings.current div.wp-menu-image { + background-position: 1px -1px; +} +#adminmenu #menu-posts-sp_team div.wp-menu-image { + background-position: 1px -97px; +} +#adminmenu #menu-posts-sp_team:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_team.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_team.current div.wp-menu-image { + background-position: 1px -65px; +} +#adminmenu #menu-posts-sp_event div.wp-menu-image { + background-position: -29px -33px; +} +#adminmenu #menu-posts-sp_event:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_event.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_event.current div.wp-menu-image { + background-position: -29px -1px; +} +#adminmenu #menu-posts-sp_player div.wp-menu-image { + background-position: -59px -33px; +} +#adminmenu #menu-posts-sp_player:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_player.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_player.current div.wp-menu-image { + background-position: -59px -1px; +} +#adminmenu #menu-posts-sp_staff div.wp-menu-image { + background-position: -89px -33px; +} +#adminmenu #menu-posts-sp_staff:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_staff.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_staff.current div.wp-menu-image { + background-position: -89px -1px; +} +#adminmenu #menu-posts-sp_table div.wp-menu-image { + background-position: -119px -33px; +} +#adminmenu #menu-posts-sp_table:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_table.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_table.current div.wp-menu-image { + background-position: -119px -1px; +} +#adminmenu #menu-posts-sp_calendar div.wp-menu-image { + background-position: -149px -33px; +} +#adminmenu #menu-posts-sp_calendar:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_calendar.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_calendar.current div.wp-menu-image { + background-position: -149px -1px; +} +#adminmenu #menu-posts-sp_tournament div.wp-menu-image { + background-position: -179px -33px; +} +#adminmenu #menu-posts-sp_tournament:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_tournament.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_tournament.current div.wp-menu-image { + background-position: -179px -1px; +} +#adminmenu #menu-posts-sp_venue div.wp-menu-image { + background-position: -209px -33px; +} +#adminmenu #menu-posts-sp_venue:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_venue.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_venue.current div.wp-menu-image { + background-position: -209px -1px; +} + +#sp_articlediv .wp-editor-container{ + background-color:#fff; +} +.widefat th.column-sp_icon, +.widefat td.column-sp_icon { + width: 32px; + text-align: center; +} + +/* admin skin */ +/* +#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, #adminmenu li.current a.menu-top, .folded #adminmenu li.wp-has-current-submenu, .folded #adminmenu li.current.menu-top, #adminmenu li.wp-has-current-submenu .wp-menu-arrow, #adminmenu li.current .wp-menu-arrow, #adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head, +#adminmenu li.wp-has-current-submenu .wp-menu-arrow div, #adminmenu li.current .wp-menu-arrow div { + background: #0082c2 !important; + border-color: #0082c2 !important; +} +*/ \ No newline at end of file diff --git a/sportspress.php b/sportspress.php new file mode 100644 index 00000000..8b092c28 --- /dev/null +++ b/sportspress.php @@ -0,0 +1,65 @@ + \ No newline at end of file diff --git a/staff.php b/staff.php new file mode 100644 index 00000000..5d635937 --- /dev/null +++ b/staff.php @@ -0,0 +1,93 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => false, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'staff' ), + ); + register_post_type( 'sp_staff', $args ); +} +add_action( 'init', 'sp_staff_cpt_init' ); + +function sp_staff_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'sp_icon' => ' ', + 'title' => __( 'Name', 'sportspress' ), + 'sp_team' => __( 'Team', 'sportspress' ), + 'sp_position' => __( 'Position', 'sportspress' ), + 'sp_league' => __( 'League', 'sportspress' ), + 'sp_season' => __( 'Season', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_staff_columns', 'sp_staff_edit_columns' ); + +function sp_staff_custom_columns( $column ) { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_staff' ): + switch ($column): + case 'sp_icon': + if ( has_post_thumbnail() ) the_post_thumbnail( 'sp_icon' ); + break; + case 'sp_position': + the_terms( $post_id, 'sp_position' ); + break; + case 'sp_league': + the_terms( $post_id, 'sp_league' ); + break; + case 'sp_season': + the_terms( $post_id, 'sp_season' ); + break; + endswitch; + endif; +} +add_action( 'manage_posts_custom_column', 'sp_staff_custom_columns' ); + +function sp_staff_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_staff' ) { + + // Positions + $selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), + 'taxonomy' => 'sp_position', + 'name' => 'sp_position', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Leagues + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Seasons + $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_season', + 'name' => 'sp_season', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + } +} +add_action( 'restrict_manage_posts', 'sp_staff_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/styles.php b/styles.php new file mode 100644 index 00000000..d0aea719 --- /dev/null +++ b/styles.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/table.php b/table.php new file mode 100644 index 00000000..80f6e6ea --- /dev/null +++ b/table.php @@ -0,0 +1,77 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => false, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'table' ), + ); + register_post_type( 'sp_table', $args ); +} +add_action( 'init', 'sp_table_cpt_init' ); + +function sp_table_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'title' => __( 'Title' ), + 'sp_team' => __( 'Teams', 'sportspress' ), + 'sp_league' => __( 'League', 'sportspress' ), + 'sp_season' => __( 'Season', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_table_columns', 'sp_table_edit_columns' ); + +function sp_table_custom_columns( $column ) { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_table' ): + switch ($column): + case 'sp_team': + echo 'TEAMS'; + break; + case 'sp_league': + the_terms( $post_id, 'sp_league' ); + break; + case 'sp_season': + the_terms( $post_id, 'sp_season' ); + break; + endswitch; + endif; +} +add_action( 'manage_posts_custom_column', 'sp_table_custom_columns' ); + +function sp_table_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_table' ) { + + // Leagues + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Seasons + $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_season', + 'name' => 'sp_season', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + } +} +add_action( 'restrict_manage_posts', 'sp_table_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/team.php b/team.php new file mode 100644 index 00000000..93fa7c67 --- /dev/null +++ b/team.php @@ -0,0 +1,114 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'team' ), + ); + register_post_type( 'sp_team', $args ); +} +add_action( 'init', 'sp_team_cpt_init' ); + +function sp_team_text_replace( $input, $text, $domain ) { + global $post; + if ( is_admin() && get_post_type( $post ) == 'sp_team' ) + switch ( $text ): + case 'Featured Image': + return __( 'Logo', 'themeboy' ); + break; + default: + return $input; + endswitch; + return $input; +} +add_filter( 'gettext', 'sp_team_text_replace', 20, 3 ); + +function sp_team_edit_columns($columns) { + $columns = array( + 'cb' => '', + 'sp_icon' => ' ', + 'title' => __( 'Team', 'sportspress' ), + 'sp_league' => __( 'League', 'sportspress' ), + 'sp_season' => __( 'Season', 'sportspress' ), + 'sp_sponsor' => __( 'Sponsor', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' ); + +function sp_team_custom_columns( $column ) { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_team' ): + switch ( $column ): + case 'sp_icon': + sp_team_logo( $post_id ); + break; + case 'sp_league': + if ( get_the_terms ( $post_id, 'sp_league' ) ) + the_terms( $post_id, 'sp_league' ); + else + echo '—'; + break; + case 'sp_season': + if ( get_the_terms ( $post_id, 'sp_season' ) ) + the_terms( $post_id, 'sp_season' ); + else + echo '—'; + break; + case 'sp_sponsor': + if ( get_the_terms ( $post_id, 'sp_sponsor' ) ) + the_terms( $post_id, 'sp_sponsor' ); + else + echo '—'; + break; + endswitch; + endif; +} +add_action( 'manage_pages_custom_column', 'sp_team_custom_columns' ); + +function sp_team_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_team' ) { + + // Leagues + $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'taxonomy' => 'sp_league', + 'name' => 'sp_league', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Seasons + $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_season', + 'name' => 'sp_season', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + // Sponsors + $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ), + 'taxonomy' => 'sp_sponsor', + 'name' => 'sp_sponsor', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + + } +} +add_action( 'restrict_manage_posts', 'sp_team_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/tournament.php b/tournament.php new file mode 100644 index 00000000..38cdc117 --- /dev/null +++ b/tournament.php @@ -0,0 +1,66 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'tournament' ), + ); + register_post_type( 'sp_tournament', $args ); +} +add_action( 'init', 'sp_tournament_cpt_init' ); + +function sp_tournament_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'title' => __( 'Title' ), + 'sp_team' => __( 'Teams', 'sportspress' ), + 'sp_event' => __( 'Events', 'sportspress' ), + 'sp_sponsor' => __( 'Sponsor', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_tournament_columns', 'sp_tournament_edit_columns' ); + +function sp_tournament_custom_columns( $column ) { + global $post, $post_id, $typenow; + if ( $typenow == 'sp_tournament' ): + switch ($column): + case 'sp_team': + echo 'TEAMS'; + break; + case 'sp_event': + the_terms( $post_id, 'sp_event' ); + break; + case 'sp_sponsor': + the_terms( $post_id, 'sp_sponsor' ); + break; + endswitch; + endif; +} +add_action( 'manage_pages_custom_column', 'sp_tournament_custom_columns' ); + +function sp_tournament_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_tournament' ) { + + // Sponsors + $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'taxonomy' => 'sp_sponsor', + 'name' => 'sp_sponsor', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + echo PHP_EOL; + + } +} +add_action( 'restrict_manage_posts', 'sp_tournament_request_filter_dropdowns' ); +?> \ No newline at end of file diff --git a/venue.php b/venue.php new file mode 100644 index 00000000..36c61873 --- /dev/null +++ b/venue.php @@ -0,0 +1,61 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'rewrite' => array( 'slug' => 'venue' ), + ); + register_post_type( 'sp_venue', $args ); +} +add_action( 'init', 'sp_venue_cpt_init' ); + +function sp_venue_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'title' => __( 'Venue', 'sportspress' ), + 'sp_address' => __( 'Address', 'sportspress' ), + 'sp_sponsor' => __( 'Sponsor', 'sportspress' ), + ); + return $columns; +} +add_filter( 'manage_edit-sp_venue_columns', 'sp_venue_edit_columns' ); + +function sp_venue_custom_columns( $column, $post_id ) { + global $typenow; + if ( $typenow == 'sp_venue' ): + switch ( $column ): + case 'sp_sponsor': + the_terms( $post_id, 'sp_sponsor' ); + break; + case 'sp_address': + echo get_post_meta( $post_id, 'sp_address', true ); + break; + endswitch; + endif; +} +add_action( 'manage_posts_custom_column', 'sp_venue_custom_columns', 10, 2 ); + +function sp_venue_request_filter_dropdowns() { + global $typenow, $wp_query; + if ( $typenow == 'sp_venue' ) { + + // Sponsors + $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; + $args = array( + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ), + 'taxonomy' => 'sp_sponsor', + 'name' => 'sp_sponsor', + 'selected' => $selected + ); + sp_dropdown_taxonomies( $args ); + + } +} +add_action( 'restrict_manage_posts', 'sp_venue_request_filter_dropdowns' ); +?> \ No newline at end of file