Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

412
Vistas
Revise Ajax Code (GIT: Lauren Gray) to work with Custom Loops

I have been using this code from Lauren Gray:

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

on my Wordpress site, and it works really well for the homepage and archive loops - any that are built into the main wp_Query. However I have created a new custom WP_Query and the AJAX doesn't work, it says "no more articles found" on click of the button...

$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;

What edits do I need to make to her code so it works with a custom loop like above?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda