I’ve googled and googled but I can’t seem to find out anything that’s understandable to me…
I want to have a static front page for my website, to this end I have created a front-page.php
file in the active theme’s folder in my FTP server. I notice any edits I do in style.css
are not reflected in front-page.php
. I want to have a separate stylesheet for my front page anyway, so how do I go about linking front-page.php
to a custom .css
file, let’s say, front-style.css
, so I can just edit the .css
file to style the .php
file? Or isn’t this the right approach?
How to load a custom stylesheet for your Front Page
front-page.php
(which you’ve done already).style.css
, but more likely, you’ll just want to override a few things). Let’s call itfront-page-style.css
.id
of thestyle.css
file (probably something along the lines ofyour-theme-css
) Trimming the-css
part will tell us what we need to use as a dependency in the code.Add the following to your theme’s
functions.php
file:You should now be able to modify styles in
front-page-style.css
for just the front page.References
wp_enqueue_style()
get_stylesheet_directory_uri()