function getMorePostsAJAX() { global $wp_query; $paged = max(1, $_POST['pagenumber']); $cat = isset($_POST['cat']) ? $_POST['cat'] : ''; $args = array('paged' => $paged, 'post_status' => 'publish', 'orderby' => 'post_date', 'order' => 'DESC', 'category_name' => $cat); srand(make_seed()); $randval = rand(); $GLOBALS['loop_rand'] = $randval; query_posts($args); if ($paged > $wp_query->max_num_pages) { die; } $arr['html'] = load_template_part('loop'); $arr['loop'] = getLoopRand(); $arr['args'] = $args; echo json_encode($arr); die; }
<?php $i = 0; //echo $GLOBALS['post_type_promo']->getPromoBlock(); if (strlen($banner1)) { ?> <div class="posts-banner"> <?php echo $banner1; ?> </div> <?php } } else { ?> <article class="hentry <?php echo getLoopRand(); ?> " data-url="<?php echo get_permalink(); ?> "> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> "><?php echo get_the_post_thumbnail(get_the_ID(), 'post_thumb'); ?> </a>