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 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 -->
<?php 
$current = date("d/m/Y");
$args = array('post_type' => 'jh_dedications');
$loop = new WP_Query($args);

    while ( $loop -> have_post() ) : $loop->the_post();
    the_title();
    endwhile;
    ?>
share|improve this question

1 Answer 1

up vote 1 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

 
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.