Add League Table widget and display future events

This commit is contained in:
Brian Miyaji
2014-02-02 05:23:43 +11:00
parent bd8561cdba
commit eca5c08d16
7 changed files with 85 additions and 27 deletions

View File

@@ -2,8 +2,8 @@
class SportsPress_Widget_Calendar extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_calendar sp_widget_calendar', 'description' => __( 'A calendar of your site’s Events.') );
parent::__construct('sp_calendar', __('Events Calendar'), $widget_ops);
$widget_ops = array('classname' => 'widget_calendar widget_sp_calendar', 'description' => __( 'SportsPress widget.', 'sportspress' ) );
parent::__construct('sp_calendar', __( 'Events Calendar', 'sportspress' ), $widget_ops);
}
function widget( $args, $instance ) {
@@ -12,7 +12,7 @@ class SportsPress_Widget_Calendar extends WP_Widget {
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '<div id="calendar_wrap sp_calendar_wrap">';
echo '<div id="calendar_wrap">';
echo sportspress_events_calendar();
echo '</div>';
echo $after_widget;
@@ -29,8 +29,9 @@ class SportsPress_Widget_Calendar extends WP_Widget {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<?php
}
}
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Calendar" );' ) );