Here is my custom function that is a widget that displays the last post the category. But I need to use some PHP script to show just the first few lines of the post. Since I am not using <!--more--> tag. I need to find another way. Also you may wonder why I am using the preg_replace its because I need to remove [gallery] from showing.
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
if (!empty($title))
echo $before_title . $title . $after_title;;
query_posts('cat=10&posts_per_page=1');
if (have_posts()) :
while (have_posts()) : the_post();
the_title(); echo '<br/>';
the_post_thumbnail(apply_filters('graphene_excerpt_thumbnail_size', 'thumbnail'));
$content = get_the_content();
echo '<p span class="here">'; echo preg_replace ('/\[.*\]/', '', $content); echo '</span></p>';
endwhile;
endif;
wp_reset_query();
echo $after_widget;
}
}
add_action( 'widgets_init', create_function('', 'return register_widget("MyWidget");') );?>