'education_master_default_tabbed', 'description' => __( 'A widget shows recent posts and comment in tabbed layout.', 'education-master' ) ); parent::__construct( 'education_master_default_tabbed', __( 'Default Tabbed', 'education-master' ), $widget_ops ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $fields = array( 'latest_tab_title' => array( 'education_master_widgets_name' => 'latest_tab_title', 'education_master_widgets_title' => __( 'Latest Tab title', 'education-master' ), 'education_master_widgets_default' => __( 'Latest', 'education-master' ), 'education_master_widgets_field_type' => 'text' ), 'comments_tab_title' => array( 'education_master_widgets_name' => 'comments_tab_title', 'education_master_widgets_title' => __( 'Comments Tab title', 'education-master' ), 'education_master_widgets_default' => __( 'Comments', 'education-master' ), 'education_master_widgets_field_type' => 'text' ) ); return $fields; } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { extract( $args ); if( empty( $instance ) ) { return ; } $education_master_latest_title = empty( $instance['latest_tab_title'] ) ? __( 'Latest', 'education-master' ) : $instance['latest_tab_title']; $education_master_comments_title = empty( $instance['comments_tab_title'] ) ? __( 'Comments', 'education-master' ) : $instance['comments_tab_title']; echo $before_widget; ?>
widget_fields(); // Loop through fields foreach ( $widget_fields as $widget_field ) { extract( $widget_field ); // Use helper function to get updated field values $instance[$education_master_widgets_name] = education_master_widgets_updated_field_value( $widget_field, $new_instance[$education_master_widgets_name] ); } return $instance; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. * * @uses education_master_widgets_show_widget_field() defined in edm-widget-fields.php */ public function form( $instance ) { $widget_fields = $this->widget_fields(); // Loop through fields foreach ( $widget_fields as $widget_field ) { // Make array elements available as variables extract( $widget_field ); $education_master_widgets_field_value = !empty( $instance[$education_master_widgets_name] ) ? wp_kses_post( $instance[$education_master_widgets_name] ) : ''; education_master_widgets_show_widget_field( $this, $widget_field, $education_master_widgets_field_value ); } } }
$education_master_comments_count ) ); foreach( $education_master_tabbed_comments as $comment ) { ?>-
comment_post_ID );
echo '
'. get_avatar( $comment, '55' ) .' ';
?>
comment_author ); ?>
: comment_content, 50 ); ?>