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 :)


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.

  • This only displays the content, not the title of the page too. Yet doing things like the_title() shows the homepage title – Chillin' Apr 24 '20 at 22:59
  • Not if done inside the loop it won't. – Johannes Pille Apr 25 '20 at 12:29

I wanted something similar but with page Title, this is how I achieved it:

$args = array(
    'post_type' => 'page',
    'title' => 'The title of the page you want'

$your_query = new WP_Query( $args );
while ( $your_query->have_posts() ) : $your_query->the_post();

The codex is your friend!


    $post_id = 7;
    $post = get_post($post_id, ARRAY_A);
    $title = $post['post_title'];
    $content = $post['post_content'];

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

It's a start.

  • 1
    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

Best way to get the current page content

global $post;
echo $post->post_content;


global $wp_query;
echo $wp_query->post->post_content;
  • The question was: how to display a different page (page about) content on homepage. About page isn't set as homepage. It was not about displaying the content of the current page. – nmr Apr 12 '19 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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