• Hi,
    I want to use a different stylesheet on a page with a different page-template. The top of my functions.php file looks like this:

    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
    function chld_thm_cfg_parent_css() {
    wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css' );
    }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
    
    // END ENQUEUE PARENT ACTION
    
    function lander_work_script() {
    if ( is_page_template('page-templates/page_prevdefault.php') ) {
    wp_enqueue_style( 'lander-work-style', get_stylesheet_directory_uri() . '/prevdefault.css');
    }
    }
    
    add_action('wp_enqueue_scripts', 'lander_work_script');

    But when I use the template prevdefault the stylesheet style.css is still being used in stead of prevdefault.css.

    Any ideas why this is… I guess something to do with the order of the enqueuing? I am pretty new to wordpress though and would appreciate any advice. Thanks

  • The topic ‘Different stylesheets for different templates – after enquing parent stylesheet’ is closed to new replies.