Add date selector to calendars

This commit is contained in:
Brian Miyaji
2014-06-18 23:01:53 +10:00
parent a9a47decd5
commit 51b115377e
5 changed files with 148 additions and 74 deletions

View File

@@ -389,6 +389,37 @@ if ( !function_exists( 'sp_dropdown_statuses' ) ) {
}
}
if ( !function_exists( 'sp_dropdown_dates' ) ) {
function sp_dropdown_dates( $args = array() ) {
$defaults = array(
'show_option_default' => false,
'name' => 'sp_date',
'id' => null,
'selected' => null,
'class' => null,
);
$args = array_merge( $defaults, $args );
printf( '<select name="%s" class="postform %s">', $args['name'], $args['class'] );
if ( $args['show_option_default'] ):
printf( '<option value="default">%s</option>', $args['show_option_default'] );
endif;
$dates = apply_filters( 'sportspress_dates', array(
0 => __( 'All', 'sportspress' ),
'w' => __( 'This week', 'sportspress' ),
'day' => __( 'Today', 'sportspress' )
));
foreach ( $dates as $value => $label ):
printf( '<option value="%s" %s>%s</option>', $value, selected( $value, $args['selected'], false ), $label );
endforeach;
print( '</select>' );
return true;
}
}
if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
function sp_dropdown_taxonomies( $args = array() ) {
$defaults = array(