rakeshr

Untitled

Aug 23rd, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. $popularpost = new WP_Query( array( 'posts_per_page' => 8, 'meta_key' => 'wpb_post_views_count', 'orderby' => 'rand meta_value_num', 'order' => 'DESC'  ) );
  3. while ( $popularpost->have_posts() ) : $popularpost->the_post(); ?>
  4. <div class="toppost">
  5. <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
  6. <div class="posttitle">
  7. <?php
  8. $topposttitle = esc_html( get_the_title() );
  9. //echo $topposttitle;
  10. echo substr($topposttitle,0,20)."...";
  11. ?>
  12. </div>
  13. <div class="postthumb">
  14. <?php if ( has_post_thumbnail() ) {
  15.  
  16.     the_post_thumbnail('tpthumbs');
  17.  
  18.     //echo get_the_post_thumbnail(get_the_ID(), array(210,120,true));
  19. } ?>
  20. </div>
  21. </a>
  22. </div>
  23. <?php endwhile;
  24. ?>
Add Comment
Please, Sign In to add comment