Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Lucas Santos
Lucas Santos
19,315 Points

Displaying Wordpress page on another page instead of posts?

Hi I had a question and have been looking online but can seem to find exactly what im looking for. I wanted to know if im on front-page.php which is my home page how would I display the contents of lets say my about page or any other page for that matter. NOT POSTS. I know that the_content() display the content of that pages WISIWIG* or if you use a custom loop with WP_Query you can display the posts but thats NOT what im looking for. I want to know if im on any page how can I display the content with in another "PAGE". Sorry if I am a bit to specific its because iv been searching and no one on google seems to understand pages not posts. Thanks you!

3 Answers

Joe Bruno
Joe Bruno
35,909 Points

Check out the codex on the get_page_by_title function and it's related functions. Depending on how many pages you eventually want to include, another option might be creating a custom loop based on a particular category, and assign those pages to that category.

Lucas Santos
Lucas Santos
19,315 Points

hmm I see how get_page_by_title can work but how can you set a category to a page? I thought you can only do that to posts.

Joe Bruno
Joe Bruno
35,909 Points

You are correct. By default you cannot. But you can use this plugin to do so or you could create a custom post type: http://wordpress.org/plugins/post-tags-and-categories-for-pages/

Matt Campbell
Matt Campbell
9,767 Points

Hi Lucas Santos. Why are you trying to import another page's content to the front page? Why not just set that page as your homepage?

Lucas Santos
Lucas Santos
19,315 Points

I don't get how that would serve the purpose because im trying to get the information from my about page to display on my main home page instead of having my about page as my home page.