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();

1 Answer 1


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.

  • how do I retrieve meta-box data within this loop?
    – MF1
    Sep 5, 2012 at 2:25
  • I'm assuming you mean post_meta data. See updated answer.
    – Chris_O
    Sep 5, 2012 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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