Add options to widgets

This commit is contained in:
Brian Miyaji
2014-03-17 22:55:24 +11:00
parent da10162988
commit b885665f21
4 changed files with 25 additions and 4 deletions

View File

@@ -6,9 +6,11 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
$id = get_the_ID();
$defaults = array(
'number' => -1,
'statistics' => null,
'orderby' => 'default',
'order' => 'ASC',
'show_all_players_link' => false,
);
$r = wp_parse_args( $args, $defaults );
@@ -55,7 +57,11 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
$i = 0;
if ( is_int( $r['number'] ) && $r['number'] > 0 )
$limit = $r['number'];
foreach( $data as $player_id => $row ):
if ( isset( $limit ) && $i >= $limit ) continue;
$name = sportspress_array_value( $row, 'name', null );
if ( ! $name ) continue;
@@ -89,6 +95,9 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
$output .= '</tbody>' . '</table>' . '</div>';
if ( $r['show_all_players_link'] )
$output .= '<a class="sp-player-list-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
return apply_filters( 'sportspress_player_list', $output );
}