Name Update Time
Netflix September 14, 2024 10:30 am
Disney+ September 10, 2024 10:09 am
Max September 14, 2024 10:20 am
ChatGPT 4 September 14, 2024 2:26 pm
Spotify September 14, 2024 2:08 pm
Prime Video September 14, 2024 2:22 pm
Codecademy September 14, 2024 2:13 pm
Grammarly September 14, 2024 4:45 pm
Canva Pro September 12, 2024 2:24 pm
Udemy Premium Cookies September 2, 2024 2:53 pm

WordPress theme-Change the stylesheet style.css path

Before this, the homepage you saw was messy because the css style had not been loaded. Now let’s add the style together. You can find this code in header.php:

`<link rel=”stylesheet” href=”./style.css” type=”text/css” media=”screen” />
`

You may ask: Isn’t there already a style.css in the wp-content\themes\bbbbf directory? Then why doesn’t header.php load css? As a result, you can see that the page is messy and it is certain that css is not loaded. Because this is a WordPress theme, it is called by the main program of WordPress and needs to be parsed layer by layer before your blog can be displayed, rather than a simple html static web page file. Correct way to change:
`<link rel=”stylesheet” href=”<?php%20bloginfo(‘stylesheet_url’);%20?>” type=”text/css” media=”screen” />
`
~~~
bloginfo(‘stylesheet_url’) outputs the absolute URL of your theme’s css file, such as http://localhost/wp/wp-content/themes/bbbbf/style.css. The WordPress program will automatically identify your WordPress installation address and the currently enabled theme, and automatically output this style.css link. Now you can try to change it, then refresh your blog homepage and check the source code of the webpage. Is the link of style.css changed to yours? Can the page be displayed normally?
~~~

What if your css file is not style.css and is not in the root directory of the theme? We can use <?php bloginfo(‘template_url’); ?> to get the URL of the theme root directory. For example, if your theme css file is abc.css, then we can write it like this: <?php bloginfo(‘template_url’); ?>/abc.css. If it is in the subdirectory css, then it is like this: <?php bloginfo(‘template_url’); ?>/css/abc.css. The same is true for loading js files.

However, there are still a few pictures whose paths are incorrect and cannot be displayed. Now let’s use a text editor to open index.php, archive.php, contact.php, full_width.php, page.php and single.php, add the correct URL to these pictures, search the code, and replace all: src=”images/,%20batch%20replace%20with%20src=”<?php bloginfo(‘template_url’); ?>/images/. Now refresh your homepage to see if the article thumbnails can be displayed normally. <?php bloginfo(‘template_url’); ?> is used to output the URL of the theme directory.