Display two posts when it should display one post
-
Hi everyone,
I have a section on my website that displays announcements and I’m having problems properly displaying it.So far, I have two posts in the custom_post called brknews. Those posts can be viewed by a metabox that adds a custom field called ‘breaking’ and ‘on’.
When they are turned off, it does not add any custom field.
This is the code:
<?php $the_query = new WP_Query( 'post_type=brknews' ); ?> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <?php if (post_custom('breaking')) { ?> <?php the_title();?> <?php } else; { ?> none <?php } ?> <?php?> <?php endwhile; ?> <?php wp_reset_query(); ?>
The problem is I want it to display none but it display none twice, exactly the number of posts that are in the ‘brknews’ section.
How do I fix the problem to show none one time, regardless on the number of posts?
Thanks,
Gregory S.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Display two posts when it should display one post’ is closed to new replies.