0

I am working on a child theme of the WordPress Twenty Ten theme. I have several pages in WordPress (About page, Testimonials page, Contact page, etc.). I want to only echo the page content (the actual about/testimonials/contact page written content and images BUT NOT the page title). I know I can echo just the page title with:

<?php single_post_title(); // echos About OR Testimonials OR Contact depending on the page selected ?>

But I cannot find a WordPress function to echo only the page content without the page title? I tried:

<?php get_template_part( 'content', 'page' ); ?>

But it doesn't output anything.

2 Answers 2

1

You can make use of the_page_content() outside the loop to display only the content of the page where the_page_content() is supported by the following function

function the_page_content() {
    global $post;

    $content = '';
    if ( is_page() ) {
        $content .= apply_filters( 'the_content', $post->post_content );
    }
    echo $content;
}

Inside the loop you can just use the_content();

1
  • Sorry, I had an error in my code, rectified Mar 8, 2015 at 10:12
0
the_content();

I think this is what you're looking for?

1
  • I tried this and it did not work for me. Mar 8, 2015 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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