Question

I'm trying to add metabox with date in WordPress. I used code from this page

It works well, but I have a problem displaying the metabox values on page.

My loop:

<?php query_posts(array('post_type' => 'event' , 'posts_per_page' => 9999, 'orderby' => 'menu_order', 'order' => 'ASC' ));
if (have_posts()) : while (have_posts()) : the_post();
$custom = get_post_custom($post->ID); ?>

<div class="event">
    <h2><?php the_title(); ?></h2>
    <p>Date: <?php echo get_post_meta($post->ID, '_day', true);?>.<?php echo get_post_meta($post->ID, '_month', true);?>.<?php echo get_post_meta($post->ID, '_year', true);?></p>
    <p>Hour: <?php echo get_post_meta($post->ID, '_hour', true);?>:<?php echo get_post_meta($post->ID, '_minute', true);?></p>
    <?php the_content(''); ?>
</div>
<?php endwhile; endif; ?>

I added custom post type 'event'. Values in metabox(date/location) have been saved, but it haven't displayed on page.

Why it doesn't work?

Thanks for reply.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top