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 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..

share|improve this question

1 Answer 1

up vote 0 down vote accepted
<?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

share|improve this answer
    
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

 
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.