A few points:
First:
You are using is_page_template()
on the “‘page-sgt_peppers.php” enqueue then you use is_page()
for “page-mp3-downloader.php”.
You should use is_page_template()
for both.
Second:
You are using wp_register_style()
incorrectly. From the codex:
A safe way to register a CSS style file for later use with
wp_enqueue_style().
Note the “later use” part. The register script function allows you to call wp_enqueue_style($handle);
later on instead of listing paths and dependency over and over. You do not have to register them at all but it is good practice so I am keeping it in my suggested fix below.
You should also register them with unique handles. Codex:
$handle (string) (required)Name of the stylesheet (which should be unique as it is used to identify the script in the whole system).
That said you can try the following:
<?php
/* This enqueues the Parent style.css file for this child theme */
function my_theme_enqueue_styles() {
$parent_style="twentyseventeen-style"; // This is 'twentyseventeen-style' for the Twenty Seventeen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
/*Register styles for later use*/
wp_register_style('wpsx-custom-style', get_stylesheet_directory_uri() . '/custom.css');
wp_register_style('wpsx-reset-mp3-style', get_stylesheet_directory_uri() . '/css/reset-mp3.css');
wp_register_style('wpsx-main-mp3-style', get_stylesheet_directory_uri() . '/css/main-mp3.css');
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
/*============= Code Added by Me ======================================- */
/* Code to enqueue(load) the custom.css file for sgt. peppers page */
function wpb_adding_styles() {
if (is_page_template('page-sgt_peppers.php')) {
wp_enqueue_style('wpsx-custom-style');
}
/* Load style sheets for MP3 Downloader page if page requested */
if (is_page_template('page-mp3-downloader.php')) {
wp_enqueue_style('wpsx-reset-mp3-style');
wp_enqueue_style('wpsx-main-mp3-style');
}
}
add_action('wp_enqueue_scripts', 'wpb_adding_styles');