Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function prefix_load_cat_posts () {
- $wp_query = '';
- $paged = '';
- $temp = $wp_query;
- $wp_query= null;
- $wp_query = new WP_Query();
- $wp_query->query('posts_per_page=4');
- while ($wp_query->have_posts()) : $wp_query->the_post();
- ?>
- <li class="recent-post shortcode-general-list-item">
- <div class="recent-post-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a></div>
- <div class="recent-post-title"><a href="<?php the_permalink(); ?>" class="recent-post-title-link"><?php the_title(); ?></a>
- <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>
- </li>
- <?php endwhile; // end of loop
- wp_reset_postdata();
- die();
- }
- add_action( 'wp_ajax_nopriv_load-filter', 'prefix_load_cat_posts' );
- add_action( 'wp_ajax_load-filter', 'prefix_load_cat_posts' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement