0

I am using this wordpress Script to add metaboxes under posts.. I followed as it was written.. but I am having trouble on how to get those values in singe.php Example an uploaded image Please guide me on this..

0
<?php if ( get_post_meta($post->ID, 'your_metabox_id', true) ) : ?>

        <?php echo get_post_meta($post->ID, 'your_metabox_id', true) ?>

<?php endif; ?>

The trick is to use get_post_meta hook

10
  • its still not displaying the value saved.. :( – nickfrancis.me Jun 13 '11 at 12:19
  • post you box creation code here – Daniel Sachs Jun 13 '11 at 12:22
  • are you using it inside the loop? – Daniel Sachs Jun 13 '11 at 12:24
  • no, I am not using it inside the loop, its after <?php content()?> – nickfrancis.me Jun 13 '11 at 12:36
  • try: <?php echo get_post_meta(get_the_ID(), 'your_metabox_id', true); ?> You need to change the "your_metabox_id" to your metabox id name. you you want to use it outside the loop use <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'your_metabox_id', true); ?> – Daniel Sachs Jun 13 '11 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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