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.

Ideally I am looking for two text boxes added to the 'Add new post' admin page, and the data from those two boxes be displayed in the sidebar when viewing the post page. So the sidebar displays the data belong to the post.... Two widgets for each post. Possible?

Thanks a ton in advance!

share|improve this question
add comment

1 Answer

You should take a look into creating custom meta boxes to display the text fields in the admin & then save that data as post meta. There are many tutorials available online for this

Once you have the information, you can put a get_post_meta call in your theme's sidebar.php file & display the data there directly. If you want it in widget format, you'll have to create a custom widget to display the meta information. Again there are many tutorials available online for this.

When displaying the info you can add a condition like

if(is_single() && 'post' == get_post_type())
    echo get_post_meta(get_the_ID(), 'custom-field-key', true);
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.