Return to Snippet

Revision: 42078
at February 26, 2011 14:56 by tomasdev


Initial Code
function get_parent_slug(){
	$parent = get_page($post->post_parent);
	return $parent->post_name;
}

Initial URL

                                

Initial Description
This is a really short function you can use inside The Loop to get the parent page slug (useful to add to the body classes or something)

Initial Title
WordPress get parent slug

Initial Tags
wordpress

Initial Language
PHP