How to avoid inside a loop the same entrance in which I am?

0

I did not know how to elaborate the question well but I hope you understand me because it is something that came up and I need the help of the most experienced in wordpress.

When I'm inside an entrance 01 and below the whole entrance I loop to show more related entries I want to avoid the same entry 01 appears on the one that I'm already reading. I would like to know how to avoid that.

I attach a referential image.

    
asked by MichaelCardoza 01.07.2017 в 10:09
source

1 answer

0

When writing the other posts, exclude the current one as follows:

$post = get_post();
$id_actual=$post->ID;
// Start the loop.
while ( have_posts() ) : the_post();

    if ( $id_actual != the_ID() ) {

    ...

    }

    // End of the loop.
endwhile;
    
answered by 02.07.2017 в 23:20