I wanted to title this post, “Church Website Maintenance Made Easy: Embed WordPress Page Data with page_id,” but that was too long.
Way, too long.
I came across this solution while working on a current WordPress project and thought I would pass it along. I wanted three columns below a main header. Each column would contain a 250px or so image followed by some supporting text with a link. There are plenty of Church websites that have this similar layout on their front page. In the past, I’ve hard coded this text in. The only problem is that if you turn a WordPress site over to a Church for their own maintenance, they’re essentially locked-out from making the edit.
Here’s the solution I came up with:
page_id
After you’ve thrown down your hawt HTML and CSS skills and thrown together your two, three or four columns into your custom front page, create the same number of corresponding Pages.
With this snippet I’m giving you, the title is irrelevant, since you’ll be pulling from the Page ID number and not the title. If you have setup three columns, create three pages. To figure-out what the Page ID is, simply mouse-over the link and you’ll see the ID in the URL.
Now, you’re ready to unload this little snippet into your WordPress template page:
[cc lang=”php”]post_content); echo $content; ?>[/cc]
(Replace the number “56” with your own Page ID number.)
Whatever text or images is placed in each page, will be dropped into the designated column.
How great is that!?!
This makes it easy for Churches, clients, even your own website, to update special content columns and boxes in your WordPress Theme. This makes updating text and images a whole lot easier than playing around in the hard code. Of course, you want to keep things like text length in mind, as it might make things ugly.
If you want to pull and render the Title, Excerpt, etc … , take a look at the WordPress Codex for more info.
Hope you like!
James Cooper says
Nifty. I also use: http://wordpress.org/extend/plugins/improved-include-page give a bit more control on how page titles are displayed… You can also use shortcoded to ’embed’ a page within a page!
Eric Dye says
Plugins are for wimps 😉
Eric Dye says
(That’s why I use them.)
Jonathan Blundell says
Good tip! I’ve been using Widgets to accomplish the same thing.
Essentially I just create the boxes on the front page and include a widget area so they can include a text field or RSS field or whatever.
Using page_ID may be a little easier as a lot of folks aren’t familiar with the Widget areas if they don’t use them regularly.