adding multiple parameters to an if statement
-
Oh, I’m not too sure how to explain this so I’ll just come out with it;
If I can exclude a post ID that matches a wp_query, can I add a meta_value parameter too?
My site displays a featured post on the index and beneath that 3 recent posts.
Featured code looks like this
$featured = new WP_Query(); $featured->query('showposts=1&meta_value=featured'); while($featured->have_posts()) : $featured->the_post(); $wp_query->in_the_loop = true; $featured_ID = $post->ID;
Once that’s done and it comes to the 3 recent posts this if statement makes sure that the featured_ID defined above isn’t displayed
if ($post->ID != $featured_ID) { ?>
This works fine, but say in the future I create another featured post within 2 posts of the last one, the older one will display in the recent posts since it no longer has the featured_ID, and I don’t want that.
So using the if statement will it be possible to make sure that anything with meta_value=featured is also not displayed?
Thanks in advance
- The topic ‘adding multiple parameters to an if statement’ is closed to new replies.