Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

102
Visualizações
WordPress Ajax post load

I've been trying (and failing annoyingly) to get an Ajax post loader to work.

This is the jQuery i'm using (its from this previous StackOverflow post: "Load More Posts" with Ajax in wordpress ), but its just not working.. I'm just trying to get an isotope list to ajax load more but everything i'm trying is failing.

jQuery(document).ready(function($){
    $('.pagination a').click(function(e)  {
    e.preventDefault();
    $('.filtered-posts').append("<div class=\"loader\">&nbsp;</div>");

    var link = jQuery(this).attr('href');

    var $content = '.filtered-posts';
    var $nav_wrap = '.pagination';
    var $anchor = '.pagination a';
    var $next_href = $($anchor).attr('href'); // Get URL for the next set of posts

    $.get(''+link+' .item', function(data){
    var $timestamp = new Date().getTime();
    var $new_content = $($content, data).wrapInner('').html(); // Grab just the content
    $('.filtered-posts .loader').remove();
    $next_href = $($anchor, data).attr('href'); // Get the new href
    $($nav_wrap).before($new_content); // Append the new content
    $('#rtz-' + $timestamp).hide().fadeIn('slow'); // Animate load
    $('.pagination a').attr('href', $next_href); // Change the next URL
    $('.pagination:last').remove(); // Remove the original navigation
    });

    });});

This is what I'm using for my js but its just not loading anything when I click on the standard previous_posts_link/next_posts_link.

I've put a div container around them to force the .pagination above.. It briefly worked but was only calling the same 9 posts once and then didn't work.

Any help would be great. Or if someone has a different Ajax Pagination guide that they know works ..

Thanks in advance :)

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda