'oneline_recent_posts_widget', 'description' => oneline_RECENT_DESC ); parent::__construct('advanced-recent-posts', RECENT_oneline_POST, $widget_ops); } function widget($args, $instance) { extract($args); $linkmore = ''; $title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Post' : $instance['title'], $instance, $this->id_base); if (!$number = absint($instance['number'])) $number = 5; if (!$excerpt_length = absint($instance['excerpt_length'])) $excerpt_length = 5; if (!$show_type = $instance["show_type"]) $show_type = 'post'; $default_sort_orders = array('date', 'title', 'comment_count', 'rand'); // by default, display latest first $sort_by = isset($instance['sort_by']) ? esc_attr($instance['sort_by']) : 'date'; $sort_order='DESC'; //Excerpt more filter $new_excerpt_more = create_function('$more', 'return " ";'); add_filter('excerpt_more', $new_excerpt_more); // Excerpt length filter $new_excerpt_length = create_function('$length', "return " . $excerpt_length . ";"); if ($instance["excerpt_length"] > 0) add_filter('excerpt_length', $new_excerpt_length); // post info array. $my_args = array( 'showposts' => $number, 'orderby' => $sort_by, 'order' => $sort_order, 'post_type' => 'post' ); $adv_recent_posts = ''; $excerpt_readmore = '[...]'; $linkmore .= ' ' . $excerpt_readmore . ''; $adv_recent_posts = new WP_Query($my_args); echo $before_widget; // Widget title ?>
have_posts()) { $adv_recent_posts->the_post(); $img_source = ''; $permalink = get_permalink(); $output = preg_match_all('//i', $post->post_content, $matches); if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { $img_source =wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'thumbnail')); $img_path=th_image_resize($img_source, 64, 64); if (!empty($img_path['url'])) { $img_source = $img_path['url']; } } elseif (isset($matches [1] [0])) { $img_source = $matches [1] [0]; $img_path=th_image_resize($img_source, 64, 64); if (!empty($img_path['url'])) { $img_source = $img_path['url']; } } if($img_source=='') continue; ?>

" name="get_field_name("excerpt_length"); ?>" value="" size="3" />