I'm using a function to add conditional titles to the header of the html; example below.
add_filter('document_title_parts', 'change_wp_title', 20, 1);
function change_wp_title($title) {
global $post, $paged;
$grappig = $title;
// 404
if (is_404()) {
$title['title'] = 'file not available';
}
elseif (is_singular( 'schedule' )){
$title['title'] = 'Schedule: ' . $title['title'];
}
// Everything else.
else {
}
return $title;
}
I want to add the title of the parent page, so that a schedule page would have a title of 'Schedule: parent_title: post_title.
I know this isn't a free code-writing service, but I've searched extensively on this and have no idea how to do it.