Hello,
I am trying to write a custom query for a page, to show posts that contain latest offers only.
The below query will bring up all the posts in the custom post type, and show the latest offers if they have them, but it also shows the posts in that custom post type even if it hasn’t got any offers.
I only want this query to bring up the posts with special offers only.
<?php
global $post;
$args = array(
'posts_per_page' => 4 , 'post_type' => 'gd_arts',);
$lastposts = get_posts( $args ); foreach ( $lastposts as $post ) : setup_postdata( $post ); ?>
<h2><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h2>
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail(array(486,226));
} ?>
<php echo $post->geodir_special_offers; ?>
<?php endforeach;
wp_reset_postdata();
?>
I dont think I am far off, I just need a little help to finish it off.
any help would be appreciated
Thanks