Pull and post title from specific page ID WordPress

Written by on May 9, 2011 in WordPress - No comments
title

Here is a quick piece of code to pull the title from one specific page in a WordPress website and write it on another page.

First get the page id of the page with the title you want to write on the other page, then replace the “66″ in the following code with the correct page id. In this example I then write (echo) the page title inside an h1 tag.

This code would go onto the php website template that you want the title to appear on.

<?php $ptitle = get_the_title( 66 ); ?>

<h1><?php echo $ptitle; ?></h1>

About the Author

Mike Ilsley "ilz" is a Boston based website designer, front-end developer, WordPress addict, owner of Beantown Design, and exclusive ThemeForest author. Check him out on Twitter, Facebook, Google+ and don't forget to subscribe to the WebDesign&Such email RSS feed. Also, check out his latest project, jQueryMobileShowcase.com.