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.

Can some one let me know How I can render the Custom Post Type Meta Fields (Meta-boxes). I have a Custom Post Type Called "News" and I successfully added a Metabox to my Custom Post Type called "News Info" which is suppose to store :
A TextField = News Resource

A Select option = News Type

A check box

enter image description here

I can retrieve the Custom post Type "News"content using a custom Loop as:

<?php
 $args = array( 'post_type' => 'news');
 $loop = new WP_Query( $args );
 while ( $loop->have_posts() ) : $loop->the_post();
    the_title();
    echo '<div class="content">';
    the_content();
    echo '</div>';
 endwhile;
?>

But I have no idea how to get the associated meta fields to "news" posts? trust me I Google this a lot but couldn't find any solution all of them just tried to render the Metabox on the admin page but no sample for presenting on the page! Can you please let me know how I can get access and render the data on the page using the wp-query loop?

Thanks

share|improve this question
    
This page never came up when you were Googling? codex.wordpress.org/Custom_Fields –  s_ha_dum Nov 7 '13 at 0:59
    
Hi, well I am lost here! are the Custom Fields same as Metaboxes? if so why are ...? –  Behseini Nov 7 '13 at 1:17
    
No, they are not the same but you would normally save data from a custom meta box as post meta (custom fields). If that is not the case, or if you don't understand what that means, then you need to do a lot of work to clarify the question. –  s_ha_dum Nov 7 '13 at 1:59
add comment

1 Answer

Use get_post_meta() function to get value of desired meta key.

You can get more details on this link: http://codex.wordpress.org/Function_Reference/get_post_meta

share|improve this answer
add comment

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.