Get parent page name

Get the parent page name to use in menus etc, or to use in a conditional tag. To use the snippet, just paste it where you want to display the parent pages name.

Code Snippet:

// get the page name
$parent_title = get_the_title($post->post_parent);

// display page name
echo $parent_title;

// Use as a conditional tag
// If pagent page is named Archives
    //do something
    //do something else

Posted in Conditional, Pages