admin管理员组

文章数量:1122846

I am using Bootstrap to put together a Wordpress. I update all my files locally and upload them through Sublime's SFTP. I also use Cyberduck to double check whether changes have gone through fully. Everything is going pretty smoothly and I can change files with ease, and see them updated with a simple refresh. However when it comes to the style.css file, updating is a doozy. I make my changes to the file, upload them, but see no changes reflected when I reload. To see the changes I have to reload the theme then make the change, upload the changed file via SFTP and reload. However, I can only do this once before refresh doesn't work any more.

In my header.php I load style.css using this php function:

<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet">

If it helps, I'm learning from this tut:

Thank you :)

I am using Bootstrap to put together a Wordpress. I update all my files locally and upload them through Sublime's SFTP. I also use Cyberduck to double check whether changes have gone through fully. Everything is going pretty smoothly and I can change files with ease, and see them updated with a simple refresh. However when it comes to the style.css file, updating is a doozy. I make my changes to the file, upload them, but see no changes reflected when I reload. To see the changes I have to reload the theme then make the change, upload the changed file via SFTP and reload. However, I can only do this once before refresh doesn't work any more.

In my header.php I load style.css using this php function:

<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet">

If it helps, I'm learning from this tut: https://www.youtube.com/watch?v=DJrGP9X2_bQ

Thank you :)

Share Improve this question asked May 10, 2018 at 2:33 EzequeilEzequeil 11 silver badge1 bronze badge 1
  • What do you mean by "reload the theme"? – Jacob Peattie Commented May 10, 2018 at 2:35
Add a comment  | 

1 Answer 1

Reset to default 4

The proper way to add a style, as in a template or in a theme, is to use the wp_enqueue_style function. See https://developer.wordpress.org/reference/functions/wp_enqueue_style/ .

One of the parameters in the function is a version number, which you can change if you make changes to the CSS in the file. That will force WP into loading the new version, and not to use a cached version of the file.

本文标签: phpWordpress stylecss not updatingonly after theme reload