WP_Widget ( False, __('Featured posts', 'theme'), Array('description' => __('Shows featured posts in your sidebar.', 'theme'))); $this->base_url = get_option('home').'/'.Str_Replace("\\", '/', SubStr( RealPath(DirName(__FILE__)), Strlen(ABSPATH) )); // Register as Widget Add_Action ('widgets_init', Array($this, 'Register')); } Function Register(){ Register_Widget('widget_theme_featured_posts'); Add_Action('wp_head', Array($this, 'Include_CSS')); } Function Include_CSS(){ Echo ''; } Function widget ($args, $settings){ If ($settings['title'] == '') $settings['title'] = __('Featured posts', 'theme'); If ($settings['limit'] == '') $settings['limit'] = 5; // Get posts $arr_feat = theme_functions::Get_Featured_Posts($settings['limit']); If (Empty($arr_feat)) return False; // print html to sidebar Echo $args['before_widget']; Echo $args['before_title'].$settings['title'].$args['after_title']; #Echo '
'; Print_R ($arr_feat); Echo '
'; Echo ''; Echo $args['after_widget']; } Function form ($settings){ // Show Form: Echo __('Title', 'theme').':
'; Echo __('Number of posts', 'theme').':
'; } Function update ($new_settings, $old_settings){ return $new_settings; } } /* End of File */