Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a page called "About Us" with some static content. I want to display that static content on the home page. Would I need to do a custom query that returns the about page, or is there a better way?

$about_page = new WP_Query('p=7'); // is this basically it? 

Is there a better way to do this? A more dynamic way that would allow me to distribute this theme to others who don't have a specific ID for an About page.

EDIT:

Found this page on the Codex. It recommends using the get_page function.

share|improve this question
    
There are so many ways to implement this. The best approach is entirely dependent on your specific use-case. Question: are you displaying the "About Us" page, or merely pulling its content into your site front page? –  Chip Bennett Oct 19 '11 at 15:29
    
Pulling. here's the site: adultdatinghistory.com Left hand side, the section called "welcome to {site name}" is pulled. –  21zna9 Oct 21 '11 at 3:48

1 Answer 1

up vote 0 down vote accepted

If you're using WP_Query, then assign that page a custom meta key 'home_content' with a value as 1. Then use WP_Query's custom field parameters to loop over it. If you can restrict the title as 'About' everywhere, use get_page_by_title, and if you can restrict the slug as 'about', use get_page_by_path. These methods will work dynamically.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.