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 working on a three-column layout where all three columns will have differing content depending on the post/page in the main column.

How would I go about giving the ability to change and update the sidebar content and display it in templates using something like <?php the_content() ?> ?

Since the sidebar content is related to the post I will need a way to reference the right sidebar content for the post.

Thanks in advance

Yours sincerely, nav

share|improve this question
    
What about get_sidebar...? –  Jared Feb 4 '12 at 15:49
    
Yes but is there a way to store the content for the sidebar in the database like the content for posts/pages. And added to the template as needed. The client can also modify it as required. get_sidebar() will work for cases where there are only a few pages but it is cumbersome and defeats the purpose of using a CMS if a static sidebar has to be created for each and every page. Kindly do let me know if I am missing something here. –  navanitachora Feb 4 '12 at 16:46
add comment

1 Answer 1

up vote 4 down vote accepted

Add a meta box to the post editor, similar to the excerpt meta box, and get the content of the meta box in your sidebar.

If you want to reuse the same text on different pages create a custom post type sidenotes and add a meta box with a select field to let the author choose the text.

share|improve this answer
    
Thank you very much for pointing me toward add_meta_box that definitely does the job. I did have a bit of trouble using it until I found this post. I thought it might help others battling with the same function. :-) –  navanitachora Feb 5 '12 at 17:19
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.