/** * * Recent * */ function cherry_last_posts($numberOfPosts = 5, $thumb = true) { global $post; $orig_post = $post; $lastPosts = get_posts('numberposts=' . $numberOfPosts); foreach ($lastPosts as $post) { setup_postdata($post); ?> <li> <?php $img_w = 55; $img_h = 55; $thumb = bd_post_image('full'); $image = aq_resize($thumb, $img_w, $img_h, true); $alt = get_the_title(); $link = get_permalink(); if (strpos(bd_post_image(), 'youtube')) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . bd_post_image('full') . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } elseif (strpos(bd_post_image(), 'vimeo')) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . bd_post_image('full') . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } elseif (strpos(bd_post_image(), 'dailymotion')) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . bd_post_image('full') . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } else { if ($image) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . $image . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } } ?> <h3><a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('%s', 'bd'), the_title_attribute('echo=0')); ?> " rel="bookmark"><?php the_title(); ?> </a></h3> <span class="date"><?php the_time(get_option('date_format')); ?> </span> <span class="post-rat"><?php echo bd_wp_post_rate(); ?> </span> </li> <?php } $post = $orig_post; }
?> <?php if (bdayh_get_option('blog_home_data_meta') == 1) { ?> <a class="date"> <?php the_time(get_option('date_format')); ?> </a> <?php } ?> <span class="widget post-rat"><?php echo bd_wp_post_rate(); ?> </span> </div> <?php } ?> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('%s', 'bd'), the_title_attribute('echo=0')); ?> " rel="author">
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $number = $instance['number']; $categories = $instance['categories']; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul> <?php global $post; $recent = new WP_Query(array('cat' => $categories, 'showposts' => $number)); while ($recent->have_posts()) { $recent->the_post(); ?> <li> <?php $img_w = 55; $img_h = 55; $thumb = bd_post_image('full'); $image = aq_resize($thumb, $img_w, $img_h, true); $alt = get_the_title(); $link = get_permalink(); if (strpos(bd_post_image(), 'youtube')) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . bd_post_image('full') . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } elseif (strpos(bd_post_image(), 'vimeo')) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . bd_post_image('full') . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } elseif (strpos(bd_post_image(), 'dailymotion')) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . bd_post_image('full') . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } else { if ($image) { echo '<div class="post_thumbnail"><a href="' . $link . '" title="' . $alt . '"><img src="' . $image . '" width="' . $img_w . '" height="' . $img_h . '" alt="' . $alt . '" /></a></div><!-- .post-image/-->' . "\n"; } } ?> <h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> <span class="date"><?php the_time(get_option('date_format')); ?> </span> <span class="post-rat"><?php echo bd_wp_post_rate(); ?> </span> </li> <?php } ?> </ul> <div class="clear"></div> <?php echo $after_widget; }