How do you include specific pages into a template?
Like for example on my websites main page I want to have about 3 different content areas that the client can regularly update as he needs to.
I figure maybe the best way to do this is to just nest pages into the template and he can edit the page.
How can I set this up? The wordpress codex, the wordpress forum, and google have all failed to give me ANY solution.
I know there is a plugin that allows this but its not compatible with 3.1 and above. I dont like the idea of using a plugin anyhow, I figured that wordpress would have a simple template tag system setup for this, wrong…. PHP is probably where the answer lays.
Thanks for your help
p.s. also if you know of a better way to go about this other than using nested pages then please let me know. I’m just a wordpress noob and I figured this would be a straightforward way to accomplish the task.
Another great way of accomplishing something like this would be taking advantage of WordPress Custom Post Types.
You could set up 3 different types of features for easy use in the WordPress back-end.
First, Set up the Custom Post Types
To do this, open up your theme’s functions.php file and include something like this:
I have written a reference on the specifics of what is going on with this code here.
You can also look into it on the codex.
What this will do is set up 3 new menus in the main left hand navigation of WordPress giving each of these types their own space in the interface. In this case, People, Places, and Things. (customize logically to suit your needs) Right now, these are set up to only show a Title bar and an Editor pane.
Query the Post Types for use on your homepage
I like to set up new query objects in order to keep everything nice and separated. Plus, you can call the objects in and out of other loops, which can be handy sometimes. Mix these (or something customized to suit your needs) into your templates to bring them into the desired pages.
Those are just some quick and dirty examples of the way you could set up the query and loop. These will just set up and display the most recent or top post from each of the Custom Post Types.
Further instruction on the WP_Query class can be found here. Everything else is just HTML and CSS.
Enjoy!
Thinking about it as including pages is a little off. Think about it as retrieving and including page’s content.
Another way would be set up special sidebar for that and let client add/remove/content via widgets. But such can easily be overkill.