0

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?

1
  • 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. May 22, 2013 at 5:10

1 Answer 1

0

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.

3
  • Beat me to it again @Milo! May 21, 2013 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, 2013 at 10:26
  • Thanks for your help, I have now managed to resolve this issue.
    – lupo
    May 23, 2013 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.