summerson
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: WP returns duplicates results on searchHi,
the solution above was correct.
I’ll post the code if someone needs. I was putting the condition in a wrong place. correct way:<?php $idAntigo = 0;?> <?php if ( have_posts() ):?> <div id="content-pages"> <?php while ( have_posts() ):the_post();?> <?php if( $post->ID == $idAntigo ){//show nothing}else{ // show the content of search?> <div class="postagem-search row"> <div class="titulo-post"> <a href="<?php the_Permalink();?>"> <?php the_title();?></a> </div> <?php if(has_post_thumbnail()):?> <div class="post-thumb"> <?php the_post_thumbnail();?> </div> <?php endif; // fim do if has_post_thumbnail?> <?php if (has_excerpt() ) : ?> <div class="resumo-post"> <?php the_excerpt(); ?> </div> <?php endif; // fim do has_excerpt?> <a href="<?php the_Permalink();?>"><button type="button" class="btn btn-primary btn-sm">Continuar Lendo...</button></a> </div> <!--fim da div postagem-search--> <?php $idAntigo=$post->ID?> <?php };?> <?php endwhile;?> <?php echo next_posts_link('Proxima pagina');?> <?php echo previous_posts_link('Anterior');?> <?php else : ?> <h4>Não foi encontrado resultado</h4> <p>Tente utilizando outra palavra-chave.</p> <?php endif; ?>
Viewing 1 replies (of 1 total)