How to get the wordpress posts parent page information out

June 29, 2012

In many cases when your working with Wordpress you'll want to assign a specific page template to become the static page. Usually replacing the homepage with a static page as well.

You can do this in Wordpress -> settings -> reading.

When you set say 'Latest News' to be your posts page you may want to get that out at the top of the loop.

Unfortunately in some cases, you might also just settle with the default template for your Latest News page (index.php) which can make things a little more annoying.

Wordpress will fill the loop with your posts rather than information about your page. Making the title of the page unavailable. This little useful snippet of code will help you overwrite that.

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.