How to Get wordpress parent page/post title?


If you use pages and subpages or posts and parent posts on your WordPress blog, it should be a good idea to display parent page/post title while on a child page. Here’s a code to do that job easily.

To achieve this recipe, simply edit your page.php file and paste the following code where you’d like your parent page title to be displayed:

$parent_title = get_the_title($post->post_parent);
echo $parent_title;


That’s all. Also, this code should be some inspiration for creating breadcrumbs.

Advertisements

5 thoughts on “How to Get wordpress parent page/post title?

  1. Wonderful beat ! I would like to apprentice while you amend your website, how could i subscribe for a weblog web site? The account helped me a appropriate deal. I have been tiny bit acquainted of this your broadcast provided brilliant clear concept

  2. I just like the valuable information you supply for your articles. I’ll bookmark your weblog and check again right here frequently. I am rather certain I will be informed many new stuff proper here! Best of luck for the next!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s