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 have a travel guide website which I have created with WordPress which contains destination guides. On the destination guides pages I have a sidebar which displays destination statistics (currency, time zone etc).
Currently I have to create a new sidebar for each page each time changing these values.

Is it possible to create a MySQL database with these values and then insert some PHP code that will identify what country page is loaded and insert the corresponding values so that I can use a single sidebar for all pages. I am fairly proficient with HTML/CSS, but my understanding of PHP is limited.

How can I do that?

share|improve this question
    
If it is a widget issue, and you need to show widgets specific to the pages, then I think Widget Context plugin can assist you. –  Mayeenul Islam May 22 '13 at 5:10

1 Answer 1

up vote 0 down vote accepted

Add the data to your pages as Custom Fields, then use one of the meta functions in your sidebar to display this data.

Note that the custom fields UI may be hidden from view on pages. If this is the case, click the Screen Options tab in the upper right corner and tick the box next to Custom Fields and the UI will appear.

share|improve this answer
    
Beat me to it again @Milo! –  Andrew Bartel May 21 '13 at 23:59
    
Thanks Milo, I believe that custom fields is what I was looking for. I am now using the Advanced Custom Fields plugin. The only problem I have now is that I have 7 pages for each country, all of which should share the same sidebar. I don't want to have to fill in these custom fields 7 times. Is it possible to have these pages inherit the custom fields from a parent page? –  lupo May 22 '13 at 10:26
    
Thanks for your help, I have now managed to resolve this issue. –  lupo May 23 '13 at 16:59

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.