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.

How i can add custom fields to custom post templates, and later print them in The Loop?

Better explanation: I want to have a custom field in "Add New" window, which will be added as some meta data to the post, which can be later printed in the loop of single.php.

I want to be able to decide where it will be, so it can be even under comments if i want to (i want to define it in template).

I dont want "Custom Field Template" plugin because AFAIK this cannot be used inside the loop.

share|improve this question

1 Answer 1

You can call get_post_custom() in The Loop, to retrieve an array with all custom fields for a post. In order to fetch a single field, you can use get_post_meta($post_id, $key, $single) with the third argument set to TRUE.

share|improve this answer
    
How to add those custom meta data to post? –  Riki137 Dec 8 '11 at 16:28

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.