Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);
- if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
- $number = 10;
- $cat_link_title = '<a href="#">'.$title.'</a>';
- $r = new WP_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'cat' => $instance['cat']));
- if ($r->have_posts()) :
- ?>
- <?php echo $before_widget; ?>
- <?php if ( $title ) echo $before_title . $cat_link_title . $after_title; ?>
- <?php while ($r->have_posts()) : $r->the_post(); ?>
- <div class="blog-list-row">
- <div class="home-thumb">
- <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'homepage-thumb-74' ); } ?></a>
- </div>
- <h3 class="post-list">
- <a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a>
- </h3>
- <p>
- <?php $excerpt = get_the_excerpt();
- echo string_limit_words($excerpt,8); ?>
- </p>
- </div>
- <?php endwhile; ?>
- <?php echo $after_widget; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement