I use the following custom post type to redirect certain pages to their first child page. Is it possible to add something so it also adopts the child page’s thumbnail? Preferably in a way that it also automatically updates if I ever change it.
<?php
/*
Template Name: Go to first child
*/
$pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");
if ($pagekids) {
$firstchild = $pagekids[0];
wp_redirect(get_permalink($firstchild->ID));
} else {
// Do whatever templating you want as a fall-back.
}
?>