I have a page that I would like users to remain on. It is like a reference guide.

Hence I would like to load post content into the page without the header / sidebar etc. Just the post content.


A dog is man's best friend. You can read more about it below.
<Post Title>
<Post Content>
You can also search for more animals here.

Do kindly assist.

  • You can do it with including wp-config.php and also include the global $wpdb; in your file. – Tejas Gajjar Jun 4 at 6:06
  • could you be kind enough to go into details.. i am clueless.. ( not a dev ) – Mor Jun 4 at 6:30
  • Is that reference guide also a wordpress page? Or external stuff? – maryisdead Jun 4 at 8:49
  • hi . . the reference guide is a wordpress page.. so basically i am trying to show contents of posts in a page ( without showing the header / side bar / footers that usually comes with the post ) – Mor Jun 4 at 9:16

You might get away with shortcodes:

add_shortcode('title', function ($atts, $content = null) {
    $atts = shortcode_atts([
        'id' => null,
    ], $atts);

    $title = '';

    if (!empty($atts['id'])) {
        $title = get_the_title($atts['id']);

    return $title;

add_shortcode('content', function ($atts, $content = null) {
    $atts = shortcode_atts([
        'id' => null,
    ], $atts);

    $content = '';

    if (!empty($atts['id'])) {
        $post = get_post($atts['id']);

        // Full content, disregarding "read more" tags:
        $content = str_replace('<!--more-->', '', $post->post_content);
        $content = apply_filters('the_content', $content);

        // Alternatively, simply use this which respects "read more" tags.
        #$content = apply_filters('the_content', $content);

    return $content;

Drop this into functions.php of the theme you are using.

In your page you can then use [title id="42"] and [content id="42"], where 42 is the ID of the post you want to display.

  • it works!!! thanks alot mary.. if i may, this is the ultimate go to that i need : essentialsbymor.com/essential-oils-reference-guide if you notice, under singles, there are many posts image pulled it by a plugin call ultimate shortcodes . . is it possible to click on that image and load the respective post or even open a new window with only the title and content? – Mor Jun 4 at 12:20
  • It surely is possible. But that's out of scope for StackExchange and you should probably hire someone to do that. – maryisdead Jun 4 at 16:14

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.