'bwt_kiss_widget_post','description' => __('Show a post/page/whatever as a widget','bwt_kiss')); $this->WP_Widget($widget_id,__('BirchWare Kiss Featured post','bwt_kiss'),$widget_ops); } function widget($args,$instance) { extract($args); echo $before_widget; echo $before_title . apply_filters('widget_title',$instance['title']) . $after_title; echo $this->getPost($instance['post_url']); echo $after_widget; } function update($new_instance,$old_instance) { $instance = $old_instance; $instance['title' ] = strip_tags($new_instance['title' ]); $instance['post_url'] = strip_tags($new_instance['post_url']); return $instance; } function form($instance) { $defaults = array('title' => __('Featured Post','bwt_kiss') ,'post_url' => '' ); $instance = wp_parse_args((array)$instance,$defaults); echo '
' . '' . '' . '
' . '' . '' . '' . '
' ; } function getPost($url) { // Originally from http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/formatting.php - function wp_trim_excerpt($text = '') $post = get_post(url_to_postid($url)); $thumbnail = get_the_post_thumbnail($post->ID,'thumbnail',array('class' => "attachment-thumbnail alignleft")); $excerpt = $post->post_content; $excerpt = strip_shortcodes($excerpt); $excerpt = apply_filters('the_content',$excerpt); $excerpt = str_replace(']]>',']]>',$excerpt); $excerpt_length = apply_filters('excerpt_length',55); $excerpt_more = apply_filters('excerpt_more',' ' . '[...]'); $excerpt = wp_trim_words($excerpt,$excerpt_length); return '