WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I've been googling and reading and testing and failing.

I'm fairly new to php, so don't expect to much :)

I'm working on a new design, and I want to show content from the about page on my homepage, which is dynamic. So, I've been looking into that the_content thing, but I havent gotten any luck so far.

   $post = get_page($id=);
   $content = apply_filters('the_content', $post->post_content);
   echo $content;

the ID of the page is "about", if that is any help.

Please get back to me :)

share|improve this question
up vote 3 down vote accepted

First off: The ID of a post or page is always an integer. "about" is either your about page's title, slug or both.

Including the following in your "homepage's" page template or in the sidebar combined with conditional tag(s) will display the about page's content:

    // query for the about page
    $your_query = new WP_Query( 'pagename=about' );
    // "loop" through query (even though it's just one page) 
    while ( $your_query->have_posts() ) : $your_query->the_post();
    // reset post data (important!)

Edit: The above works, IFF your page's slug is indeed "about", otherwise adjust accordingly.

share|improve this answer
I pasted in the code, and "about" is the slug and title of the page, however it was a no-go. – Stian Nov 10 '11 at 2:16
@Stian Sorry. Corrected the above. The 'name=xxx' query parameter is for post slugs. Use 'pagename=xxx' instead - that's por page slugs. Tested and works. – Johannes Pille Nov 10 '11 at 2:33
That worked perfectly, I love you! – Stian Nov 10 '11 at 14:45

The codex is your friend!


    $my_id = 7;
    $post_id_7 = get_post($my_id, ARRAY_A);
    $title = $post_id_7['post_content'];

(ARRAY_A - Returns an associative array of field names to values)

It's a start.

share|improve this answer
I have been using the codex, but I find it hard to understand. Keep in mind that I've been coding php for like 2 days :) – Stian Nov 10 '11 at 2:19
All in fun :) - hope this helped. – Sterling Hamilton Nov 10 '11 at 3:34

Your Answer


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.