Advertisement
Guest User

Untitled

a guest
May 30th, 2018
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. function prefix_load_cat_posts () {
  2. $wp_query = '';
  3. $paged = '';
  4. $temp = $wp_query;
  5. $wp_query= null;
  6. $wp_query = new WP_Query();
  7. $wp_query->query('posts_per_page=4');
  8. while ($wp_query->have_posts()) : $wp_query->the_post();
  9. ?>
  10.  
  11. <li class="recent-post shortcode-general-list-item">
  12. <div class="recent-post-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a></div>
  13. <div class="recent-post-title"><a href="<?php the_permalink(); ?>" class="recent-post-title-link"><?php the_title(); ?></a>
  14. <div class="recent-post-bottom"><span class="recent-post-bottom-child"><?php echo get_the_author(); ?> <?php printf( _x( '%s ago', '%s = human-readable time difference', 'textdomain' ), human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) ); ?></span></div></div>
  15. </li>
  16.  
  17. <?php endwhile; // end of loop
  18. wp_reset_postdata();
  19. die();
  20. }
  21. add_action( 'wp_ajax_nopriv_load-filter', 'prefix_load_cat_posts' );
  22. add_action( 'wp_ajax_load-filter', 'prefix_load_cat_posts' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement