• Home  / 
  • WordPress
  •  /  WordPress Tip #1 – Page Content on the Posts Page

WordPress Tip #1 – Page Content on the Posts Page

If you’ve used WordPress a fair bit, you’re probably familiar with the practice of using a ‘static page’ as your home page, and specifying another page to act as your ‘posts page’ (which displays a list of your posts).

If you don’t know what I’m talking about, this WordPress Codex article explains it clearly.

One important point that the above-mentioned codex article emphasises is ‘DO NOT add content to the Blog Page. Leave it blank. Any content here will be ignored’

This means that any content you add to your ‘posts page’ will not show up on the published page. It will only show the list of posts.

This has frustrated me for years, as I often want to include a sort of introduction at the top of the blog, and until recently I have resorted to hard-coding this into the theme.

However, I recently stumbled upon the following solution, which allows the contents of the ‘post page’ to be output as well as the list of posts.

Just add the following code to your index.php file in your theme directory:

if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') && is_home() ) : the_post();
	$page_for_posts_id = get_option('page_for_posts');
	<div id="post-<?php the_ID(); ?>" class="page">
		<div class="entry-content">
			<?php the_content(); ?>
			<?php edit_post_link('Edit', '', '', $page_for_posts_id); ?>

See our articles page for an example. The introductory text above the posts list comes from the WordPress page.

Source: http://zeo.my/

About the author

Dan Johnson

Dan used to be a WordPress developer at WDFS, but now he has gone off to pursue his passion for art, and he blogs about making a living from creativity at Right Brain Rockstar

HAROLD - 4 years ago



Adam - 4 years ago

Thanks, this was driving me crazy.

Paul B. Taubman, II - 4 years ago

I have been looking for something like this, on and off, for months now! Thanks for posting this.

On a similar note… I would install WP in the root. I would use the static page to create an ‘intro’ page, or to have my squeeze page on the root. My blog page would be titled, Blog so it looked as if it was installed in a sub-directory

Recently, I started to leave the root of a domain open, and installing WP in a sub-directory (/blog/ as before). However, my root would be a .html file

Any thoughts on this practice?

Be Well.

Erik Teichmann - 4 years ago

Thanks for this, very helpful!

FYI, if you want to include the title from your static content page, you’ll have to do it like so:


If you just use the_title(), WordPress will still display the title of the first post.

    Douglas Rogers - 3 years ago

    Your solution didn’t show up. What exactly will you have to do in order for it to show?

Adrian - 3 years ago


( jason ) - 3 years ago

Once I figured out what hook to use in my child theme, it worked like a charm. Thank you!

jomachi - 3 years ago

Very effective and useful tip. But how show the page title ? Because adding the the_title() function show the first post title instead of the page title. Thanks.

Gareth Joyce - 3 years ago


This is what I did to display the_title() hope my code displays.

				<div id="post-" class="page">
Gareth Joyce - 3 years ago

No it didn’t!!

Try adding this:

$title = get_the_title($page_for_posts_id);

Then echoing out $title where you need it.


Arshaan - 3 years ago

Thanks a lot. Had been looking for this all day :)

avremy cohen - 3 years ago

you guys are great

Jody Heatth - 3 years ago

Thanks for your post. I’m new to wordpress. Although this your wasn’t exactly what I was looking for, it helped get me thinking in the right direction to find this other article which was exactly what I was looking for. It’s a simple way to top post any blog post you like by using only the edit visibility section drop down (right above the update button):

Kelly - a couple of years ago

Ok totally new to hosted wordpress blog. I am completely missing the details here. I simply added this section of code to my theme index.php and nothing changed.

Please give me details!


Mehrshad - a couple of years ago

Dear Sir
Hi. Tank you for this code. I’m very new in this field and if you give me a simple explanation it makes me very appreciated. I use a child-theme twentytwelve for my website. For application of this code I mad an index.php file in the child’s directory and added this code to it (at the very top of index.php). Subsequently, website posts page just showed the static text without any style on a totally white page and all posts disappeared. Would you do me a favour please? Which parts of the process I did were incorrect?

    Ben Hunt - a couple of years ago

    Hi Mershad. Unfortunately, Dan, who wrote this post, has moved on to great things at WooThemes.

JB - a couple of years ago

RAD. this worked for me. Thanks for posting

Dan Hansen - a couple of years ago

For anyone having trouble getting post data to work other than the_content, the reason is actually documented in the WP codex: https://codex.wordpress.org/Function_Reference/setup_postdata . It’s an issue with how setup_postdata() likes working with the actual global $post variable.

To fix it and be able to use things like the_ID() and the_title(), change this line:


to read:

global $post; //you may not need this
$post = get_page(page_for_posts_id);

And the other functions should start working.

Jens Mikkelsen - a couple of years ago

Nice thank you for your tip :)
Weird that its isn’t default in WordPress 3.6

yasmina - a couple of years ago

I am seriously looking crazy for this. But where the heck do you out them? I am using prose theme. I can get my site go live because of this. Please respond . Do I have to put it in the style sheet CSS and where exactly. I don’t know where the home.php is. On the right side all I see is
Function.php. And landing.php and initial.php
I’ve been looking for days and and I am tired.
So please help :)

    Ben Hunt - a couple of years ago

    Hi Mina. Dan, the author of this post now works at WooThemes, and I don’t have the particular expertise to be able to help you, sorry.

yasmina - a couple of years ago

Ohh too bad but thanks for you respond

Comments are closed