rocknbil - 3:48 pm on May 31, 2012 (gmt 0)
I do these in one of two ways. Which I choose depends on what is going to be easiest for the non-tech savvy owner who will maintain the site, because that's really the point of a CMS. :-)
- Child documents. Sometimes it's easier to structure it as child documents. For example, if a site has a locations page with multiple locations, I'll make each page a child of the visible locations page. Each child has a simple "block" containing the address/phone info, and may or may not have custom fields with Google Map data, either a full code URL or just the coordinates.
The advantage to this is that data can be pulled for other areas of the site; for example, if the location bits are used in a global footer, a short function pulls it from child_of [the id of locations].
This requires a little custom coding and a custom coded menu, or some plugin that allows you to selectively pick resources that appear in menus.
- As mentioned, sometimes it's easier to place this data in custom fields. This also might require a little custom coding.
For both of these, centralize your code - put functions with a return value you need in functions.php and structure it so when you need to get this info, you just call the function.
echo get_location_page_data($post->ID); // on the locations page itself
echo get_custom_menu(1,24,35,67,123); // ID's of main menu items, for example
For this last one, a better way is to have a custom field "include_in_top_menu" on every page you want in the menu, then use that field to determine which items appear in the menu. This puts the control of that back in the hands of the Wordpress admin.
Or, you could look for plugins - somehow it seems more efficient to write a 20-30 line function that will remain stable through all updates and not require frequent updates, like a plugin might.