<div class="postimage_container"> <span class="thumb"> <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail(); ?> </a> <?php } else { echo onepage_main_image(); } ?> <span> <?php // Get the Name of First Category //Fetching all the categories for the post and displaying first pocket the_category(', '); ?> </span> </span> <div class="clear"></div> </div> <h1 class="post_title"><a href="<?php the_permalink(); ?>
/** * This is our Widget * */ function widget($args, $instance) { global $post, $wp_query; $post_type = 'post'; extract($args); // Widget options $title = apply_filters('widget_title', $instance['title']); // Title $cpt = $instance['types']; // Post type(s) $types = explode(',', $cpt); // Let's turn this into an array we can work with. $number = $instance['number']; // Number of posts to show // Output echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="ratting_widget"> <?php $wp_query->query('showposts=' . $number . '&post_type=' . $post_type); $wp_query->is_archive = true; $wp_query->is_home = false; if (have_posts()) { while (have_posts()) { the_post(); ?> <li> <div class="widget_thumb"> <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { ?> <?php the_post_thumbnail('post_thumbnail_1', array('class' => 'postimg')); ?> <?php } else { ?> <?php echo onepage_main_image(); ?> <?php } ?> </div> <div class="widget_content"> <h6><a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?> "><?php $tit = the_title('', '', FALSE); echo substr($tit, 0, 30); if (strlen($tit) > 30) { echo "..."; } ?> </a></h6> <h6 class="title"><a href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?> "> </a></h6> <?php echo onepage_trim_excerpt(7); ?> </div> </li> <div class="clear"></div> <?php } wp_reset_query(); } ?> </ul> <?php // echo widget closing tag echo $after_widget; }