修改 Ajax 代码(GIT:Lauren Gray)以使用自定义循环

use*_*227 5 ajax wordpress loops

我一直在使用 Lauren Gray 的这段代码:

https://gist.github.com/graylaurenm/86daa4f23aa8749c0933f72133ac7106

在我的 Wordpress 网站上,它非常适用于主页和存档循环——任何内置在主 wp_Query 中的循环。但是,我创建了一个新的自定义 WP_Query 并且 AJAX 不起作用,单击按钮时显示“找不到更多文章”...

$loop = new WP_Query( array( 
            'post_type' => 'post', 
            'paged' => $paged, 
            'posts_per_page' => 10 
        ) );


    if ( $loop->have_posts() ) :
        while ( $loop->have_posts() ) : $loop->the_post(); 

        remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
        remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
        remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
        add_action( 'genesis_entry_header', 'genesis_do_post_image', 8 );
        add_action('genesis_entry_header','add_play_button');

        echo '<article class="' . $countClasses . implode( ' ', get_post_class() ) . '">'; // add column class
        do_action( 'genesis_entry_header' );
        echo '</article>';

        endwhile;
        if (  $loop->max_num_pages > 1 ) : 
            echo '<div class="load-more"><a class="load-more-button" id="'.$pageType.'"><i class="fa fa-caret-down" aria-hidden="true"></i> Load More</a></div>';
        endif;
    endif;

Run Code Online (Sandbox Code Playgroud)

我需要对她的代码进行哪些编辑才能使其与上述自定义循环一起使用?