Use get_page to pull static page content into page template
-
Hi there
Though I know my way around HTML and CSS, I’m still a youngling in WordPress theme design. I’d appreciate any help and suggestions, or – at least – being pointed into a definitive direction.
Here’s where I’m at and what I want to achieve…
The homepage setup:
- The homepage for my site is a static page that uses a custom page template
- I’ve created the homepage static page in wp-admin in the pages menu
- I set the page to use my custom page template (home.php) in Page Editor – Page Attributes – Template
- I set the homepage (Front Page) to a static page in Admin – Settings – Reading
- All working.
The content page and what I want to do:
- I have created a static page named “The Content Page” (with the slug: /the-content-page, and the post id: 2)
- I want this page to be hidden (I’m using WP3.1’s menu managment, so I figured I’d just not include it)
- I want to pull the content from this page (the-content-page) into a div in my custom homepage template (home.php)
- Obviously, I want this to happen outside of my main loop
- This is not happening in a sidebar (so please don’t suggest plugins)
- Most importantly, I want the content without any formatting.
- And, possibly have the option to change the formatting as I see fit, like changing the title output (like wrapping it in an h3 instead of h2), text output, etc
Where I’m at:
I figured I should be using “get_page” to achieve this (?) and have gone through a number of posts and forum suggestions on how to achieve this. Most notably, this one: https://www.ads-software.com/support/topic/get_pagepost-and-no-paragraphs-problem?replies=5
But the output in these examples outputs the content as it is in the original post.
Could anyone please give me the code snippet to achieve what I want to do here? Or point me to a (forum) post that outlines this definitively? Really, any constructive help would be appreciated.
Thanks in advance.
- The topic ‘Use get_page to pull static page content into page template’ is closed to new replies.