rubencio (February 10th, 2013)
// classipress sidebar top ads today widget // modified by Lyle to enable choosing number of items shown class CP_Widget_Top_Ads_Today extends WP_Widget { function CP_Widget_Top_Ads_Today() { $widget_ops = array( 'description' => __( 'Your sidebar top ads today', APP_TD ) ); $this->WP_Widget( 'top_ads', __( 'CP Top Ads Today', APP_TD ), $widget_ops ); } function widget( $args, $instance ) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Popular Ads Today', APP_TD ) : $instance['title']); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; cp_todays_count_widget(APP_POST_TYPE, $instance['item_count']); echo $after_widget; } function update($new_instance, $old_instance) { $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['item_count'] = strip_tags(stripslashes($new_instance['item_count'])); return $instance; } function form($instance) { ?> <p> <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?></label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ($instance['title'])) {echo esc_attr( $instance['title']);} ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('item_count'); ?>"><?php _e( 'Items to Display:', APP_TD ); ?></label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('item_count'); ?>" name="<?php echo $this->get_field_name('item_count'); ?>" value="<?php if (isset ($instance['item_count'])) {echo esc_attr( $instance['item_count']);} ?>" /> </p> <?php } } // classipress sidebar top ads overall widget // modified by Lyle to enable choosing number of items shown class CP_Widget_Top_Ads_Overall extends WP_Widget { function CP_Widget_Top_Ads_Overall() { $widget_ops = array( 'description' => __( 'Your sidebar top ads overall', APP_TD ) ); $this->WP_Widget( 'top_ads_overall', __( 'CP Top Ads Overall', APP_TD ), $widget_ops ); } function widget( $args, $instance ) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Popular Ads Overall', APP_TD ) : $instance['title']); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; //echo '<div>'; cp_todays_overall_count_widget(APP_POST_TYPE, $instance['item_count']); //echo "</div>\n"; echo $after_widget; } function update($new_instance, $old_instance) { $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['item_count'] = strip_tags(stripslashes($new_instance['item_count'])); return $instance; } function form($instance) { ?> <p> <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?></label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ($instance['title'])) {echo esc_attr( $instance['title']);} ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('item_count'); ?>"><?php _e( 'Items to Display:', APP_TD ); ?></label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('item_count'); ?>" name="<?php echo $this->get_field_name('item_count'); ?>" value="<?php if (isset ($instance['item_count'])) {echo esc_attr( $instance['item_count']);} ?>" /> </p> <?php } }
rubencio (February 10th, 2013)
There are currently 1 users browsing this thread. (0 members and 1 guests)