html - Changing CSS FilePath for All Pages

admin2025-01-08  3

So I need to change multiple CSS Style sheet paths for a WordPress website. They rely on a domain that is no longer going to be active. What is the best way to apply the path of these CSS file to all pages within my website and future pages as they are created.

So I need to change multiple CSS Style sheet paths for a WordPress website. They rely on a domain that is no longer going to be active. What is the best way to apply the path of these CSS file to all pages within my website and future pages as they are created.

Share Improve this question edited Apr 3, 2018 at 15:34 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Apr 3, 2018 at 14:17 ztmcoderztmcoder 1112 bronze badges 4
  • you want to point to an external location where your css files located? – MonTea Commented Apr 3, 2018 at 14:30
  • Yes. It is literally going from: domain1.com to domain2.com for all them and the paths after the .com are the same. Maybe a find and replace in NotePad++ by doing FTP, but would have to do each page one by one. – ztmcoder Commented Apr 3, 2018 at 14:54
  • If you use a Child-Theme u can add the changes to your header.php in the <head>, but I would copy the css files to your new domain and use it native. – MonTea Commented Apr 3, 2018 at 15:20
  • What if the header file doesn't match what is showing in the page source <header> section of each page? – ztmcoder Commented Apr 4, 2018 at 13:04
Add a comment  | 

1 Answer 1

Reset to default 0

You can override your Header <head> ... </head> in the header.php of your Theme.

I prefere you create a Childtheme, if you don't know how, let me google that for you ;).

And than simply copy your header.php from your Parent Theme in /wp-content/themes/your-theme to /wp-content/themes/your-child-theme (replace the theme dir with yours).

And add your styles after <?php wp_head(); ?> and before </head> like normally css-styles will add:

<link rel="stylesheet" href="/wp-content/themes/your-child-theme/css/yourStylesheet.css" type='text/css' media='all' />

The Styles will add to each page.

Hope it helps.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736266347a1113.html

最新回复(0)