On functions.php I have the following which works on the homepage :
function load_page_styles() {
if (is_front_page()) {
wp_register_style('home', get_template_directory_uri() . '/css/home.css', array(), 1, 'all');
wp_enqueue_style('home');
wp_register_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.css', array(), 1, 'all');
wp_enqueue_style('font-awesome');
} else if (is_page( 'about')) {
wp_register_style('about', get_template_directory_uri() . '/css/about.css', array(), 1, 'all');
wp_enqueue_style('about');
}
}
add_action( 'wp_enqueue_scripts', 'load_page_styles' );
It is working fine at it showing the css file in /wp-content/themes/roots-restaurant
<link rel="stylesheet" id="home-css" href="http://localhost:8000/wp-content/themes/roots-restaurant/css/home.css?ver=1" type="text/css" media="all">
But on about us page it does not work. It shows the path as the following, which is wrong as it is targeting the wp-admin folder:
<link rel="stylesheet" id="about-css" href="http://localhost:8000/wp-admin/css/about.min.css?ver=5.4.2" type="text/css" media="all">
About Us template is in the following:
/wp-content/themes/roots-restaurant/template-about.php
Could you help me with this.
Ronny