From 39d7bbac7f4a25227823d86768bf8b3c6fcb3963 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 3 Feb 2014 05:51:09 +1100 Subject: [PATCH] Add Events widget --- admin/hooks/admin-enqueue-scripts.php | 4 + admin/post-types/event.php | 6 +- admin/post-types/list.php | 4 +- admin/post-types/table.php | 5 +- admin/templates/events-calendar.php | 6 +- admin/templates/events.php | 65 ++++++++++++ admin/templates/league-table.php | 12 ++- admin/widgets/events.php | 145 ++++++++++++++++++++++++++ admin/widgets/table.php | 10 +- assets/css/admin.css | 16 +++ assets/css/themeboy.css | 31 ++++++ assets/fonts/themeboy.eot | Bin 0 -> 3152 bytes assets/fonts/themeboy.svg | 12 +++ assets/fonts/themeboy.ttf | Bin 0 -> 2984 bytes assets/fonts/themeboy.woff | Bin 0 -> 3040 bytes functions.php | 29 ++++-- readme.txt | 2 +- sportspress.php | 6 +- 18 files changed, 323 insertions(+), 30 deletions(-) create mode 100644 admin/templates/events.php create mode 100644 admin/widgets/events.php create mode 100755 assets/css/themeboy.css create mode 100755 assets/fonts/themeboy.eot create mode 100755 assets/fonts/themeboy.svg create mode 100755 assets/fonts/themeboy.ttf create mode 100755 assets/fonts/themeboy.woff diff --git a/admin/hooks/admin-enqueue-scripts.php b/admin/hooks/admin-enqueue-scripts.php index 998282c0..c08a14a5 100644 --- a/admin/hooks/admin-enqueue-scripts.php +++ b/admin/hooks/admin-enqueue-scripts.php @@ -1,5 +1,9 @@ 'sp_league', 'name' => 'sp_league', 'selected' => $league_id, - 'value' => 'term_id', + 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); sportspress_dropdown_taxonomies( $args ); @@ -73,7 +73,7 @@ function sportspress_event_details_meta( $post ) { 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $season_id, - 'value' => 'term_id', + 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); sportspress_dropdown_taxonomies( $args ); @@ -86,7 +86,7 @@ function sportspress_event_details_meta( $post ) { 'taxonomy' => 'sp_venue', 'name' => 'sp_venue', 'selected' => $venue_id, - 'value' => 'term_id', + 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); sportspress_dropdown_taxonomies( $args ); diff --git a/admin/post-types/list.php b/admin/post-types/list.php index ef5428c3..94858dc9 100644 --- a/admin/post-types/list.php +++ b/admin/post-types/list.php @@ -60,7 +60,7 @@ function sportspress_list_player_meta( $post ) { 'taxonomy' => 'sp_league', 'name' => 'sp_league', 'selected' => $league_id, - 'value' => 'term_id' + 'values' => 'term_id' ); sportspress_dropdown_taxonomies( $args ); ?> @@ -72,7 +72,7 @@ function sportspress_list_player_meta( $post ) { 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $season_id, - 'value' => 'term_id' + 'values' => 'term_id' ); sportspress_dropdown_taxonomies( $args ); ?> diff --git a/admin/post-types/table.php b/admin/post-types/table.php index b4916bba..138df389 100644 --- a/admin/post-types/table.php +++ b/admin/post-types/table.php @@ -38,6 +38,7 @@ function sportspress_table_meta_init( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); remove_meta_box( 'sp_seasondiv', 'sp_table', 'side' ); + remove_meta_box( 'sp_leaguediv', 'sp_table', 'side' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_table_team_meta', 'sp_table', 'side', 'high' ); if ( $teams && $teams != array(0) ): @@ -57,7 +58,7 @@ function sportspress_table_team_meta( $post, $test ) { 'taxonomy' => 'sp_league', 'name' => 'sp_league', 'selected' => $league_id, - 'value' => 'term_id' + 'values' => 'term_id' ); sportspress_dropdown_taxonomies( $args ); ?> @@ -69,7 +70,7 @@ function sportspress_table_team_meta( $post, $test ) { 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $season_id, - 'value' => 'term_id' + 'values' => 'term_id' ); sportspress_dropdown_taxonomies( $args ); ?> diff --git a/admin/templates/events-calendar.php b/admin/templates/events-calendar.php index 42960b54..a704d855 100644 --- a/admin/templates/events-calendar.php +++ b/admin/templates/events-calendar.php @@ -80,7 +80,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) { '; if ( $previous ) { - $calendar_output .= "\n\t\t".'« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . ''; + $calendar_output .= "\n\t\t".'« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . ''; } else { $calendar_output .= "\n\t\t".' '; } @@ -88,7 +88,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) { $calendar_output .= "\n\t\t".' '; if ( $next ) { - $calendar_output .= "\n\t\t".'' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' »'; + $calendar_output .= "\n\t\t".'' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' »'; } else { $calendar_output .= "\n\t\t".' '; } @@ -157,7 +157,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) { $calendar_output .= ''; if ( array_key_exists($day, $daywithpost) ) // any posts today? - $calendar_output .= '$day"; + $calendar_output .= '$day"; else $calendar_output .= $day; $calendar_output .= ''; diff --git a/admin/templates/events.php b/admin/templates/events.php new file mode 100644 index 00000000..aeee8542 --- /dev/null +++ b/admin/templates/events.php @@ -0,0 +1,65 @@ + 'sp_event', + 'posts_per_page' => 1, + 'post_status' => 'publish', + 'tax_query' => array(), + ); + + if ( isset( $args['number'] ) ): + $options['posts_per_page'] = $args['number']; + endif; + + if ( isset( $args['status'] ) && $args['status'] == 'any' || $args['status'] == 'scheduled' ): + $options['post_status'] = array( 'publish', 'future' ); + endif; + + if ( isset( $args['league'] ) ): + $options['tax_query'][] = array( + 'taxonomy' => 'sp_league', + 'field' => 'id', + 'terms' => $league + ); + endif; + + if ( isset( $args['season'] ) ): + $options['tax_query'][] = array( + 'taxonomy' => 'sp_season', + 'field' => 'id', + 'terms' => $season + ); + endif; + + if ( isset( $args['venue'] ) ): + $options['tax_query'][] = array( + 'taxonomy' => 'sp_venue', + 'field' => 'id', + 'terms' => $venue + ); + endif; + + $query = new WP_Query( $options ); + + if ( $query->have_posts() ): + $output = ''; + wp_reset_postdata(); + endif; + + return apply_filters( 'sportspress_events', $output ); + + } +} diff --git a/admin/templates/league-table.php b/admin/templates/league-table.php index 7f84b3c1..8cf5f5bd 100644 --- a/admin/templates/league-table.php +++ b/admin/templates/league-table.php @@ -17,19 +17,23 @@ if ( !function_exists( 'sportspress_league_table' ) ) { $seasons = get_the_terms( $id, 'sp_season' ); $terms = array(); - if ( sizeof( $leagues ) ): + if ( $leagues ): $league = reset( $leagues ); $terms[] = $league->name; endif; - if ( sizeof( $seasons ) ): + if ( $seasons ): $season = reset( $seasons ); $terms[] = $season->name; endif; $title = sizeof( $terms ) ? implode( ' — ', $terms ) : get_the_title( $id ); - $output = '

' . $title . '

' . - '
' . + if ( ! is_singular( 'sp_table' ) ) + $output = '

' . $title . '

'; + else + $output = '

' . $title . '

'; + + $output .= '
' . '' . '' . ''; $data = sportspress_get_league_table_data( $id ); diff --git a/admin/widgets/events.php b/admin/widgets/events.php new file mode 100644 index 00000000..a43d0253 --- /dev/null +++ b/admin/widgets/events.php @@ -0,0 +1,145 @@ + 'widget_recent_entries widget_sp_events', 'description' => __( 'SportsPress widget.', 'sportspress' ) ); + parent::__construct('sp_events', __( 'Events', 'sportspress' ), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); + $status = empty($instance['status']) ? null : $instance['status']; + $league = empty($instance['league']) ? null : $instance['league']; + $season = empty($instance['season']) ? null : $instance['season']; + $venue = empty($instance['venue']) ? null : $instance['venue']; + $team = empty($instance['team']) ? null : $instance['team']; + $number = empty($instance['number']) ? get_option( 'posts_per_page' ) : $instance['number']; + $args = array( + 'status' => $status, + 'league' => $league, + 'season' => $season, + 'venue' => $venue, + 'team' => $team, + 'number' => $number, + ); + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + echo '
'; + echo sportspress_events( $args ); + echo '
'; + echo $after_widget; + } + + function update( $new_instance, $old_instance ) { + $instance = $old_instance; + $instance['title'] = strip_tags($new_instance['title']); + $instance['status'] = strip_tags($new_instance['status']); + $instance['league'] = intval($new_instance['league']); + $instance['season'] = intval($new_instance['season']); + $instance['venue'] = intval($new_instance['venue']); + $instance['team'] = intval($new_instance['team']); + $instance['number'] = intval($new_instance['number']); + + return $instance; + } + + function form( $instance ) { + $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'status' => '', 'league' => '', 'season' => '', 'venue' => '', 'team' => '', 'number' => 3 ) ); + $title = strip_tags($instance['title']); + $status = strip_tags($instance['status']); + $league = intval($instance['league']); + $season = intval($instance['season']); + $venue = intval($instance['venue']); + $team = intval($instance['team']); + $number = intval($instance['number']); +?> +

+

+ +

+ __( 'Any', 'sportspress' ), + 'played' => __( 'Played', 'sportspress' ), + 'scheduled' => __( 'Scheduled', 'sportspress' ), + ); + ?> + + +

+ 'sp_league', + 'name' => $this->get_field_name('league'), + 'id' => $this->get_field_id('league'), + 'selected' => $league, + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), + 'hide_empty' => 0, + 'values' => 'term_id', + 'class' => 'widefat', + ); + wp_dropdown_categories( $args ); + ?> +

+ +

+ 'sp_season', + 'name' => $this->get_field_name('season'), + 'id' => $this->get_field_id('season'), + 'selected' => $season, + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ), + 'hide_empty' => 0, + 'values' => 'term_id', + 'class' => 'widefat', + ); + wp_dropdown_categories( $args ); + ?> +

+ +

+ 'sp_venue', + 'name' => $this->get_field_name('venue'), + 'id' => $this->get_field_id('venue'), + 'selected' => $venue, + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Venues', 'sportspress' ) ), + 'hide_empty' => 0, + 'values' => 'term_id', + 'class' => 'widefat', + ); + wp_dropdown_categories( $args ); + ?> +

+ +

+ 'sp_team', + 'name' => $this->get_field_name('team'), + 'id' => $this->get_field_id('team'), + 'selected' => $team, + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ), + 'values' => 'ID', + 'class' => 'widefat', + ); + if ( ! sportspress_dropdown_pages( $args ) ): + sportspress_post_adder( 'sp_table' ); + endif; + ?> +

+ +

+

+ 'widget_league_table widget_sp_league_table', 'description' => __( 'SportsPress widget.', 'sportspress' ) ); - parent::__construct('sp_table', __( 'League Table', 'sportspress', 'sportspress' ), $widget_ops); + parent::__construct('sp_table', __( 'League Table', 'sportspress' ), $widget_ops); } function widget( $args, $instance ) { @@ -35,17 +35,19 @@ class SportsPress_Widget_League_Table extends WP_Widget {

-

+

'sp_table', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), - 'show_option_none' => __( '-- Select --', 'sportspress' ), 'selected' => $id, 'values' => 'ID', + 'class' => 'widefat', ); - sportspress_dropdown_pages( $args ); + if ( ! sportspress_dropdown_pages( $args ) ): + sportspress_post_adder( 'sp_table' ); + endif; ?>

KbCTx0`<|^PjpM}L65C1bIWMKGl&sY#&}Gnyehj+0ZAe-* zO|)iWl|bts+Zbr9L<1h*n zG#uc!b&K@0Ie*wpUgUG3=RW_fssx9 zrNk-TN0t|9?%X|5ox0fupC_l~q^}#R9-JcHLi$ePk+J=UK3&}0HbVM1sq4l^t9#(D zr@si$^gOK(j+4Ro68{hBZ;;+SJ~91B6krcPG(vjI{>j}{k!RhcyQD`as*g-TA67{u z8+0D1PK@4~nEeOo>nO+Y)a1cwIwy_TlX@Mv06YpI0Cs|1BFmA0<1Hv-llE&ENXK3{ z))e9AmU#vMVPJ4&eBTfP0-TpjTEc< zl92`i(t2}4Y>Mfv@>6A@G<$*1@SjuECc4ZvXooEH!w?L^y)XisVH@m#-E{4rfzQGd za0GqR@)7cn5bhbLKcHM%qi0v4@DKrAAVAGM=}Fuf`6(0yCa=HH>t24XexxX~TB3ebLiZ z%9b+eTsk|L9n8JQg9vnF!^n7=ER;y=alB^c%>8mbWS}X-G8}Mgp4()%5=^uDlPhvB z=b)1_$~h;aNsg#N>FLx9iJ!QO!uDYo9Z{?NqI7Who`TFzZj*)Q9(VHRPs#jShs(-OoS$mmwo|dYeoOd{C znzl!5^&7kJf^*er=OP>u9}>dgB6K*!)HxSDtEetvh=n4)c!N?2?026zp)PSOadmzP z%Jsk@t}b)IIKwhmSLj$Fj=j8~{>{;~`hU;gPTu)L{!&~2=lF@_om===+dwy8o9yP6 z#l}vaWGvav`rQre0rz3{WJ_G#u1RoBrgNUHq2YtNvu+ zJy!oOlYdWTIEGN{5=6Oq)MS=vX5;acX(owc+)Odf1)50|oHJh|mgK1av38S9@pw~v z;66uNku$nBMmHu-lhJqPaUF^_Of<7n1xI(lrzPposBWg?sC4Fo( zntVv>n#YVs;W79EJPlukq6LK2&3SmTOQ zwxlJEj8pC^g-aQSgvN>F*9a=Ux(Hc#nu;*%r3p#`#4u=2R%T1NkYV>!dTcvX3E6hK zlD5&ukVWO}t3gdC7?pI9X{9GkzFt~`gyvx@Z21OBl7A*b6-kz!v{xpm2#7adFVDOVkId$GwBpwwHs8)Xu9tQ*MxXFH6_HhWgihD5)q=3as*48Tequ!ZjH_ru3x=objwyMZ4D28 z!3)2r$%Sy5F2M{SLzm-xnaAsek5q;lVCHBeVyJf)LQc%T2Lhv*hM@$ZPCTwYXvV3G zm#pCz2|O6#33&(LvJk=u-6(lE9Hz}1{rpFHaetXp)Eq?;9i4^nTUhjv>$ z67WJjChGpME;H(B?yJk3?Af|3Nd9D94pGb6QkTPY=E1rgg*&LJrLIdfkwwQ0v)-Zk~TLCnQ%^wJIUBCqN3(TUMrlZXDV318TNFWN<2+$c5Sx*@O9 f&Qa=pJE?g;M05l7b(64>rf$=NE_3l)ZP5P*ieB^x literal 0 HcmV?d00001 diff --git a/assets/fonts/themeboy.svg b/assets/fonts/themeboy.svg new file mode 100755 index 00000000..b1820ec1 --- /dev/null +++ b/assets/fonts/themeboy.svg @@ -0,0 +1,12 @@ + + + +Generated by IcoMoon + + + + + + + + \ No newline at end of file diff --git a/assets/fonts/themeboy.ttf b/assets/fonts/themeboy.ttf new file mode 100755 index 0000000000000000000000000000000000000000..0c0606d4c5d471af55120ab7a536b8f7e9bfe032 GIT binary patch literal 2984 zcmZuzeQX>@6@PDL?)H4QdyeDX*}YTj_&I({ zrim{jeHZcA_<_S;C~avUC4GX_^%G;Yz3{iwUk7M;iS~yk$Y6Yf|CjW)N$;7MoOvV; zuooa6BYoL{sXaAOU_GRJq{k;~k4!^9)<`59bRDcsj@_D^`zPt^DaXk4)S(%=Cym6D zdLOs|d>SGE>;$_+mZKrZTTsCk?YCecU3>9Z2VFOjpP8e{&%ip`)X$1eMw&Hz$w&hMX}@(rY&z$!4pQZyJa>W5@?TKY7Dz%n zbU+RUU>HW=ei(%7aS2@-cx*naG$D{7Tr zlrE0kSCoaR?Xvj7<8I;nDOq?I5wFQ2wlic(x&2t+C`f$EDdI;WoJAN@7i0lfOZ97+ zZ&R;JwvWU%^>5ZD>#xzt(^7Si^G;XI(D9g~e(MxpcCWe}Ttp+{6G9kVM2(4rD!mfYY4rp{&+)XAJJBb%f$G+F@+vlC|Hh5=K zx3PXb#XjxztE!E+=}$i6;di_~^=BLJvj={a`bRp;F@j>ZAj++$EoNI*&NS1Ol_H9! zm1dj^v{EQIXMsj6#Zmub?Iv4Hv!x?+Z_+m8j9wd~HzrP#F>vOl4n>D?+YZYzEgGhY zR>P*FCuW1hI=5wo)Q!ha?bvz>6KKv)!$1p@G&!T^PMqnFVP3cBafv`r27XaL>ZMnj z2e)J5r)ZfJI&WET>Z=Ahf|QazHX1Dfq;=0@#-s2Ud<~w0Z^3c+KKvMd4zIy^_znCH zuE15e0XN|mybE*msaPm+CEkTaEaQh*@c?cntZ=dwBaiuN#n0YhQGNKd96#@8?pe!p zITQOB&KI^z*bq#O9WEh>Lo}*!#jV)VmPXdCbeE&$tV_beh2*yoR04GgvhWNQVb0GG zl!S<3(3zafmGcq9>8WhujKI!k5s$y1D#zPo{$9CxzdZ7seCe$G zg8)2$oz~FR*29{j6KSpE;`2F5%}rb;#?(7F%7m zOF#6kc`F1rMCASmkFkh&R6MBO5R8fod-wvV;OYVk1`eT`#e13yZ^`;|lI2@#74QBAvo zWvp#G)W5dHn}r)xuNB|AjY?a?Ls0M{C~9&coTisxg^;1kalXvWM&Tosp$3>HU5FU! zgT;`O2;KvMQ9{E|l2FGq)yFN9%J_~o{0e~wBRnDR5L^~R7@->_uSBDCcvFyHtDKV> z_9xUh+4eB z@+j*SSmUfmbd#i;6@d>?Z=y#tYM?Yo5?*e^MBN`YWJW#B0}YvzJ=c&0$)9V;5s;(> z?GQxi&O;434tK!;-ARcSvgnwh9L5agFlH!+F+(|w8Ol*QyS8yQj5$O7)EG?C+6_~1 z7(PqV7vT`>Bkdq`!73dRrFQrXogRmW>8>@3vg8zXabpxy$FI@e d81=qgl=U#tjnvmo!6sTdYuIHr9_F3c{{fDl;#2?t literal 0 HcmV?d00001 diff --git a/assets/fonts/themeboy.woff b/assets/fonts/themeboy.woff new file mode 100755 index 0000000000000000000000000000000000000000..c57642cc8f0aa63af5098de9d45711776d51b390 GIT binary patch literal 3040 zcmcguU2IfE6h3!%hu*fNfc6qWt$h$f6tLSyjM0z=wWjf>LUKmrlNgQ%DwgcvLjMzM;<#0Q`Ji^Pa;Lhib=uzqLe?qA`-CuTBt&iUrd znRD;?x$|aILqpT5RZT?Yzfc*Wl~0hx^UdwahK6dOSBdN}kNU@*KbuxQTuW5i4E!}7 z6`%MYYK??80s9R6Q#>x;NzrwoEx_~vHZUHu+ryzYU`#L7g z9_iW&46-zv2eh%`lqW~Wmpc21Za_PocMS83vwI+GO z>7EeBq>w#gK#Imw&LvH+kpg(jamNj4zBb3#XkN|F0nGq(v*m7~8Z^EJ8}~~Qi*mPB zXHNKiDF&n5ZFL|AUXUUYjicM@bPj|a!+m0?FM)2WsY3i{k5E{Kfo;c}?RzwHbV4Mr zOTkOuO0j)hs6!{5VxI&2vZbJ@Ti(X!c5U*q)>iTF_59**bmPKVzW zU?QHdU3>uu_YXMkqB@~!f;}^`y-7f4KwfkeH0w*$rR86$$RPYxJr~_#wgF zcF*C61L76c;;4h>(2tDiFfn3)eYtn3H^Ax~P-%b%vs)h3{I%?Qt7c(7Uaz&wk>lbp zyt79n|8*N2Hy9M|qThv74Wd_zAUqI=FKhY-O)t^3YimYTNwIUE*f}cHDUB!L6>Lbq zZ8)|+I)HAcPa5QNDf*+_Z4QF&T_X9j6n#}!oEj?P zq(9Yb$=@`JP)WaP0AwOGwRAdZVSr#(LVchC_op1N$^g4H5bk#R2e{h{@ZvG<_Kq>( zE|g-&UQv;1NuG90rpKgE9BaWpL^`C7fPo*hcM!ZeuYt}v6tv2Fo4I^2Ft-689}$aK zVJ;s^%$cau;kaA7oR1rfiD@~&qBms=gZZ3d4hfE_Al;GmoNr!T@VMgY!C-NnVWhYm zF~Y9NSFK|}ZmMrAmal@$;#l z=ju{iGmLOS)wvbm?ewY?(q>nBrGvQTykY-fY7F1@AXjJI6;46U!V)h0#Yygg#kIf# zi%W(F7FQO4?$uKc7a=AQGjKNkd7R%2Am;(po#&D;J}kz2y?TH(gg2Jl(Pa)7EdX8# zlh|ElcAHuUV2S2U9hB!Cl*pmDkbUeklt}C~<+36*R+$=e@ztiN)l>Cl%RiYx_fJwi)(Y=s)mqkvCvG%Ui6^gC;!;tA*+%Cz zXvkd8WHd!gWqzIS^JD>{S!7{-mfj5w^Nvi#T4p_QjmiUh`8#@SKNDuoT=Y-*&w(}C zc>#OaM#8~pkNBswCZ@AZFR(EnYIzW?@WiQtKJ?@*eYZ1j=mY+Ohx>s);L!ol%^odi zE;u7U1NJQS=rUSJ8~6$Kw1w7#>!4~1(h_|8X;Rr+;B=f`#O`&}4O>IdGHn+ null, 'selected' => null, 'hide_empty' => false, - 'value' => 'slug', + 'values' => 'slug', + 'class' => null, ); $args = array_merge( $defaults, $args ); $terms = get_terms( $args['taxonomy'], $args ); $name = ( $args['name'] ) ? $args['name'] : $args['taxonomy']; + $class = $args['class']; + unset( $args['class'] ); if ( $terms ) { - printf( '', $name, $class ); if ( $args['show_option_all'] ) { printf( '', $args['show_option_all'] ); } @@ -244,7 +247,7 @@ if ( !function_exists( 'sportspress_dropdown_taxonomies' ) ) { printf( '', $args['show_option_none'] ); } foreach ( $terms as $term ) { - if ( $args['value'] == 'term_id' ) + if ( $args['values'] == 'term_id' ) printf( '', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name ); else printf( '', $term->slug, selected( true, $args['selected'] == $term->slug, false ), $term->name ); @@ -259,6 +262,8 @@ if ( !function_exists( 'sportspress_dropdown_pages' ) ) { $defaults = array( 'show_option_all' => false, 'show_option_none' => false, + 'option_all_value' => 0, + 'option_none_value' => -1, 'name' => 'page_id', 'selected' => null, 'numberposts' => -1, @@ -275,20 +280,23 @@ if ( !function_exists( 'sportspress_dropdown_pages' ) ) { 'exclude_tree' => null, 'post_type' => 'page', 'values' => 'post_name', + 'class' => null, ); $args = array_merge( $defaults, $args ); $name = $args['name']; unset( $args['name'] ); $values = $args['values']; unset( $args['values'] ); + $class = $args['class']; + unset( $args['class'] ); $posts = get_posts( $args ); - if ( $posts ) { - printf( '', $name, $class ); if ( $args['show_option_all'] ) { - printf( '', $args['show_option_all'] ); + printf( '', $args['option_all_value'], $args['show_option_all'] ); } if ( $args['show_option_none'] ) { - printf( '', $args['show_option_none'] ); + printf( '', $args['option_none_value'], $args['show_option_none'] ); } foreach ( $posts as $post ) { if ( $values == 'ID' ): @@ -298,7 +306,10 @@ if ( !function_exists( 'sportspress_dropdown_pages' ) ) { endif; } print( '' ); - } + return true; + else: + return false; + endif; } } @@ -882,7 +893,7 @@ if ( !function_exists( 'sportspress_edit_event_results_table' ) ) { 'post_type' => 'sp_outcome', 'name' => 'sp_results[' . $team_id . '][outcome]', 'show_option_none' => __( '-- Not set --', 'sportspress' ), - 'option_none_value' => 0, + 'option_none_value' => '', 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'selected' => $value diff --git a/readme.txt b/readme.txt index ebcf6b14..fd8ba6a1 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: sports, sports journalism, teams, team management, fixtures, results, stan Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress Requires at least: 3.5 Tested up to: 3.8 -Stable tag: 0.2.1 +Stable tag: 0.2.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html diff --git a/sportspress.php b/sportspress.php index 8a66c514..0eee5009 100644 --- a/sportspress.php +++ b/sportspress.php @@ -6,7 +6,7 @@ Plugin Name: SportsPress Plugin URI: http://themeboy.com/sportspress Description: Manage your club and its players, staff, events, league tables, and player lists. -Version: 0.2.1 +Version: 0.2.2 Author: ThemeBoy Author URI: http://themeboy.com/ License: GPLv3 @@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) { exit; } -define( 'SPORTSPRESS_VERSION', '0.2' ); +define( 'SPORTSPRESS_VERSION', '0.2.2' ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ ); @@ -40,6 +40,7 @@ require_once dirname( __FILE__ ) . '/admin/templates/event-players.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-results.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php'; +require_once dirname( __FILE__ ) . '/admin/templates/events.php'; require_once dirname( __FILE__ ) . '/admin/templates/events-calendar.php'; require_once dirname( __FILE__ ) . '/admin/templates/league-table.php'; require_once dirname( __FILE__ ) . '/admin/templates/player-league-statistics.php'; @@ -72,6 +73,7 @@ require_once dirname( __FILE__ ) . '/admin/terms/venue.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php'; // Widgets +require_once dirname( __FILE__ ) . '/admin/widgets/events.php'; require_once dirname( __FILE__ ) . '/admin/widgets/calendar.php'; require_once dirname( __FILE__ ) . '/admin/widgets/table.php';