Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have the following query in WordPress to call custom post meta, everything is working fine, with one exception, whichever query is second is echoing nothing. Sorry for the WordPress post, but for those unfamiliar the 'get_post_meta($post->ID' is retrieving the post ID for the first one and then echoing the same for the second, I need to close the first query but don't know how.

            <h3 class="body_heading">
            <?php $soon_events = get_post_meta($post->ID, 'coming_soon_events', true); if ($soon_events) : echo $soon_events; endif; ?>
            </h3>   

        <h3 class="body_heading clear">
            <?php $feat_events = get_post_meta($post->ID, 'featured_events', true); if ($feat_events) : echo $feat_events; endif; ?>
        </h3>
share|improve this question

1 Answer 1

up vote 3 down vote accepted

Try <?php wp_reset_query(); ?> after each function. See Function Reference/wp reset query « WordPress Codex

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.