- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’ve made some custom meta boxes, but I can’t get the info to display outside the loop.
I’ve tried using this but I get nothing
global $post;
$args = array('post_type' =>'post-type');
$meta = get_post_meta($post->ID, 'meta-box-slug', true);
wp_reset_query();
And I’ve tried this too
global $post;
$args = array('post_type' => 'post-type');
$obituary_query = new WP_Query($args);
while ($obituary_query->have_posts()) : $obituary_query->the_post();
$meta = get_post_meta($post->ID, 'meta-box-slug', true);
echo $meta;
endwhile;
wp_reset_query();
That does displays the data but it throws a “Headers already sent error”
I’m not sure what I’m doing wrong. I haven’t had much luck working with custom meta boxes.
Thanks in advance.
Are you using a plugin?
No, but I may just be stupid. I just thought of something. I’ll let you know if it works.
OK, yeah I’m stupid. For some reason, I was got it in head that I had to work outside the loop.