function.phpに以下を追加
add_filter('page_template_hierarchy', 'my_page_templates');
function my_page_templates($templates) {
	global $wp_query;
	$template = get_page_template_slug();
	$pagename = $wp_query->query['pagename'];
	if ($pagename && ! $template) {
		$pagename = str_replace('/', '-', $pagename);
		$decoded = urldecode($pagename);
		if ($decoded == $pagename) {
			array_unshift($templates, "page-{$pagename}.php");
		}
	}
	return $templates;
}

latest post

0