Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="widget listing_articole widget_top_articole">
- <h4 class="widget-title">Top articole</h4>
- <span class="cand">7 zile</span>
- <?php
- function filter_where($where = '') {
- $where .= " AND post_date > '" . date('Y-m-d', strtotime('- 7 days')) . "'";
- return $where;
- }
- add_filter('posts_where', 'filter_where');
- if (false === ( $toparticole = get_transient('widget_tp') )) {
- $toparticole = new WP_Query(array(
- 'ignore_sticky_posts' => 1,
- 'post_status' => 'publish',
- 'posts_per_page' => 5,
- 'orderby' => 'comment_count',
- 'order' => 'DESC',
- ));
- set_transient('widget_tp', $toparticole, 1 * HOUR_IN_SECONDS);
- }
- ?>
- <ul class="widget-articole">
- <?php while ($toparticole->have_posts()) : $toparticole->the_post(); ?>
- <?php
- static $position;
- $position ++;
- ?>
- <li class="post-<?php the_ID(); ?>">
- <?php if (has_post_thumbnail()) { ?>
- <div class="post-photo">
- <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
- <?php the_post_thumbnail('small-thumb'); ?>
- </a>
- </div>
- <?php } else { ?>
- <div class="post-photo">
- <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <img width="60" height="60" alt="<?php the_title_attribute(); ?>" src="<?php echo get_stylesheet_directory_uri(); ?>/images/noimg.png" />
- </a>
- </div>
- <?php } ?>
- <div class="post-description">
- <h5 class="title"><a href="<?php esc_url(the_permalink()); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h5>
- <p class="widget-time"><?php the_time('j F Y') ?></p>
- </div>
- <span class="pozitie">#<?php echo $position; ?></span>
- </li>
- <?php
- endwhile;
- wp_reset_query();
- remove_filter('posts_where', 'filter_where');
- ?>
- </ul>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement