WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to display data from a custom post type on my home page, for which I am using a separate template.

I'm getting a Fatal error: Call to undefined method WP_Query::have_post() when my code looks like this:

get_header(); ?>
<div class="home_main_text">

<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'home' ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #primary -->
$current = date("d/m/Y");
$args = array('post_type' => 'jh_dedications');
$loop = new WP_Query($args);

    while ( $loop -> have_post() ) : $loop->the_post();
share|improve this question
up vote 2 down vote accepted

while ( $loop -> have_post() ) : $loop->the_post();

Your missing an s have_post() should be have_posts();

Your title says retrieving meta-box and I am assuming you mean the post_meta. Which you use the get_post_meta() function.

share|improve this answer
how do I retrieve meta-box data within this loop? – MF1 Sep 5 '12 at 2:25
I'm assuming you mean post_meta data. See updated answer. – Chris_O Sep 5 '12 at 2:35
yes! Thank you! – MF1 Sep 5 '12 at 2:39

Your Answer


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.