</div> <div class="row post-wrapper trc-wrapper"> <div class="col-xs-12"> <div class="trending-topic"><span class="svg svg-icon svg-attack-icon-color"></span><span class="trending-slogan a">Attack</span></div> </div> <?php get_brand_posts('attack'); ?> </div> <div class="row"> <div class="col-xs-12"> <?php get_standard_loop(); ?> </div> </div> </div> </div> </div> </section> </div> <?php
function ajax_load_posts() { global $exclude_posts; $nonce = isset($_POST['postCommentNonce']) ? $_POST['postCommentNonce'] : ''; if (!wp_verify_nonce($nonce, 'myajax-post-comment-nonce')) { die('Busted!'); } $options = array(); parse_str($_POST['options'], $options); $exclude = isset($_POST['exclude_posts']) ? json_decode(stripslashes($_POST['exclude_posts'])) : array(); $defaults = array('author' => 0, 'type' => '', 'loops' => 2, 'category' => 0, 'search_str' => ''); // merge options with defaults $options = array_merge($defaults, $options); // $exclude_posts = array_merge((array) $exclude_posts, (array) $exclude); $combined_exclude_posts = array(); foreach ($exclude as $key => $arr) { $combined_exclude_posts[$key] = array_unique(array_merge($arr, (array) $exclude_posts[$key])); } $exclude_posts = $combined_exclude_posts; ob_start(); get_standard_loop($options); $result = ob_get_contents(); ob_end_clean(); echo json_encode(array('results' => $result, 'exclude_posts' => $exclude_posts)); exit; }