Force page template on child pages in WordPress
This is something that could come in handy. I’ve found a need for it in using the Nextgen Gallery plugin with the gallery page link setting enabled.
// Force page template on child pages $page_children = get_pages('child_of=13'); foreach($page_children as $child){ $current_page_template = get_post_meta($child->ID,'_wp_page_template',true); if($current_page_template != 'page-OTHER_PAGE_TEMPLATE.php') update_post_meta($child->ID,'_wp_page_template','page-PARENT_PAGE_TEMPLATE.php'); }Published on August 21, 2013