WordPress custom pages in a folder

Something like this:

  1. In your child theme, create a directory to hold your template files as desired; e.g. a “custom_pages” directory, with the according 10 template php files holding the code for these 10 pages inside, like my_page_1.php, my_page_2.php, and so on.

  2. Also in your child theme folder; you setup ONE template file like my_custom_page.php; with the following content, more or less, in this example using your templates in function of the ID of the requested page:

<?php
/* Template Name: Custom Pages */

if ( is_page( 1, 2, 3 ) ) {

  require get_stylesheet_directory().'/custom_pages/my_page_1.php';
  
} elseif ( is_page( 4, 5, 6 ) ) {

  require get_stylesheet_directory().'/custom_pages/my_page2.php';

}
?>
  1. In your WP admin, you then select the page template “Custom Pages” under Page Attributes for all the concerned pages.

  2. In your functions.php file of your child theme; to enqueue your page-specific js and css files; you then add something like:

function insert_custom_scripts() {

  if ( is_page( 1, 2, 3 ) ) {

    wp_enqueue_script( ... )

  } elseif ( is_page( 4, 5, 6 ) ) {

    wp_enqueue_script( ... )

  }

}

add_action( 'wp_enqueue_scripts', 'insert_custom_scripts' );

for js, and similar for the page – specific stylesheets. For a precise description of the enqueuing functions, check this and this.