Hi,
I have a single.php page, where it shows the post data.
At the bottom of the page I want to display all other posts expect the current post.
But I didn’t manage to achieve that. Could you please let me know what I’m doing wrong?
That’s my single.php
<?php get_header(); ?>
<section class="bg-black-500 pb-20 pt-48 px-6 relative sm:px-12 xl:px-20">
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/bg-line.alt1.png" class="absolute bottom-0 h-full right-0 z-0"/>
<div class="relative z-10 lg:w-1/2">
<div class="flex items-center mb-8">
<h1 class="font-bold pr-10 text-4xl text-white tracking-wider uppercase"><?php the_title(); ?></h1>
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/dot-line.png" class="mt-2">
</div>
<p class="font-light text-white text-xl"><?php echo get_the_excerpt(); ?></p>
</div>
</section>
<section>
<?php the_content(); ?>
</section>
<section class="bg-white px-6 py-10 relative sm:px-12 xl:px-20 xl:py-16">
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/bg-line.png" class="absolute bottom-0 h-full right-16 z-0"/>
<div class="flex items-center relative z-10">
<h2 class="font-bold pr-10 text-4xl text-black-800 tracking-wider uppercase"><?php _e( 'Autres SERVICES', 'solid_design' ); ?></h2>
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/bg-line.alt.png" class="mt-2">
</div>
</section>
<section class="text-white">
<div class="mx-auto relative">
<?php
$post_query_args = array(
'post__not_in' => PG_Helper_v2::getShownPosts(),
'post_type' => 'post',
'nopaging' => true,
'order' => 'ASC',
'orderby' => 'date'
)
?>
<?php $post_query = new WP_Query( $post_query_args ); ?>
<?php if ( $post_query->have_posts() ) : ?>
<div class="flex flex-wrap">
<?php while ( $post_query->have_posts() ) : $post_query->the_post(); ?>
<?php PG_Helper_v2::rememberShownPost(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class( 'bg-black-500 w-full sm:w-full lg:w-1/5' ); ?>><a href="<?php echo esc_url( get_permalink() ); ?>"><div class="flex h-28 items-center justify-center px-6">
<h3 class="font-bold mb-2 text-3xl text-center text-white"><?php the_title(); ?></h3>
</div><div class="h-96 overflow-hidden">
<?php echo PG_Image::getPostImage( null, 'large', array(
'class' => 'duration-300 ease-in-out h-full hover:opacity-100 hover:scale-110 object-cover opacity-90 w-full'
), 'both', null ) ?>
</div></a>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.', 'solid_design' ); ?></p>
<?php endif; ?>
</div>
</section>
<?php get_footer(); ?>
On the link below, you can see that on the bottom the post “Cuisine” is showing, and it shouldn’t because I’m already on the post “Cuisine”.
https://takuyaweb.synology.me/projects/solid-design/service/cuisine/
Thanks for your help,
Siegfried