Enqueuing Stylesheet for custom page template of child theme.
-
Ok, So I am pretty new to wordpress. I am creating a child theme and want to make a custom page template that enqueues a specific stylesheet when on that custom page template. I created the custom page and was able to select it from the backend and I used this code to enqueue the stylesheet in the functions.php:
function lander_work_script() {
if ( is_page_template(‘/page-templates/page-work.php’) ) {
wp_enqueue_style( ‘lander-work-style’, get_template_directory_uri() . ‘/layouts/page-workStyle.css’);
}
}add_action(‘wp_enqueue_scripts’, ‘lander-work-script’);
The problem is the stylesheet is not loading correctly. It is looking for the file in the parent theme from what i can tell. How do I fix this?
- The topic ‘Enqueuing Stylesheet for custom page template of child theme.’ is closed to new replies.