I think you need in your query is post__not_in
but you aren’t showing any code:
taken from WP_Query:
$query = new WP_Query( array( 'post_type' => 'post', 'post__not_in' => array( 2, 5, 12, 14, 20 ) ) );
if you want to exclude that particular post you’re in you would do:
'post__not_in' => array($post->ID),
Other questions on the topic:
**
EDIT
**
Based on your code example I would take a guess you have two different querys going on. One for the full width image and the remaining for the image left and content right areas. I would still apply the same rule of 'post__not_in' => array($post->ID)
but if you’re asking to omit the feature category you would use 'category_not_in' => 'feature',
. So the arguments would look like:
$args = array(
'posts_per_page' => 5,
'meta_key' => 'meta-checkbox',
'meta_value' => 'yes',
'post__not_in' => array($post->ID),
);
$featured = new WP_Query($args);
or
$args = array(
'posts_per_page' => 5,
'meta_key' => 'meta-checkbox',
'meta_value' => 'yes',
'category_not_in' => 'feature',
);
$featured = new WP_Query($args);
A few pointers I follow when coding:
- I do not see a
wp_reset_postdata();
at the end of your loop. I’ve always been taught it’s good to reset the query after it’s been called. Reference “wp_reset_postdata() or wp_reset_query() after a custom loop?“
use the “what if” mentality:
- You call for
the_category(', ');
but you do not consider if you do not have a category checked so you should possibly considerhas_category()