Change template_directory to use a CDN path

Posted on 16th September, 2015 212 Comments

So you’ve created your theme and you would like to switch to using a CDN for your scripts and CSS…

Add this to your functions.php and replace the YOUR-SITE with the urls of the website and the CDN.

add_filter( 'template_directory_uri', function( $template_dir_uri ){
return str_replace( 'http://www.YOUR-SITE.co.uk/', '//cdn.YOUR-SITE.co.uk/', $template_dir_uri );
});

Comments

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]

JamesVen

20th, Oct, 20

be a outstrip urgently fitted the next legit and Mawkishness [url=https://ciamedusa.com/]cialis from canada[/url] Owekek qfiwwt cialis effective buying cialis online safely

JamesVen

21st, Oct, 20

propagation: To delays the device go along an allergist of. [url=https://ciamedusa.com/#]generic cialis india[/url] and misinterpreting them its compromises to position statement

카지노사이트

07th, Jan, 21

Thanks again for stopping by, Solanski. Hope you’re having a great weekend.
You know, “trying not to sound like an idiot” is a pretty decent approach to commenting. If only every commenter took that approach! Haha.
카지노사이트

hey

13th, Jan, 21

Taxi moto line
128 Rue la Boétie
75008 Paris
+33 6 51 612 712  

Taxi moto paris

Pretty! This was an incredibly wonderful article.
Thank you for providing these details.

vreyrolinomit

17th, Jan, 21

Hmm it appears like your website ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to everything. Do you have any recommendations for beginner blog writers? I’d certainly appreciate it.

Lcxeloks

21st, Jan, 21

viagracanada viagra canada pfizer viagra [url=http://genqpviag.com/]where can i buy viagra in ireland[/url] ’

KbbtBoth

24th, Jan, 21

cheap. generic cialisis Lotensin best price for cialis 20 mg [url=https://xz-pharmacyonline.com]canadian drugstore[/url] ’

froleprotrem

28th, Jan, 21

I have been checking out some of your posts and i can claim clever stuff. I will surely bookmark your site.

부산달리기

03rd, Feb, 21

I?m amazed, I have to claim. Truly rar부산달리기
ly do I come across a blog that?s both educative as well as amusing, and also let me inform you, you have actually hit the nail on the head. Your suggestion is exceptional; the concern is something that not nearly enough individuals are speaking smartly about. I am very happy that I came across this in my look for something connecting to this.

froleprotrem

05th, Feb, 21

Hiya very cool web site!! Guy .. Excellent .. Superb .. I will bookmark your site and take the feeds additionally?KI’m happy to search out a lot of useful information here in the publish, we’d like develop more strategies in this regard, thanks for sharing. . . . . .

antivirüslere yakalanmayan php shell

08th, Feb, 21

When I originally commented I clicked the “Notify me when new comments are added”
checkbox and now each time a comment is added I get several emails with the same comment.
Is there any way you can remove me from that service?
Thanks!

vreyro linomit

08th, Feb, 21

Hello! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly? My site looks weird when viewing from my iphone. I’m trying to find a theme or plugin that might be able to correct this issue. If you have any recommendations, please share. Thanks!

Ybacroli

13th, Feb, 21

texas department of health & – cialis generic Aagilvz
does cialis for women work
cialis price compared to viagra: [url=https://www.withoutbro.com/]viagra for sale[/url]

Google

26th, Feb, 21

Google

Here are some links to web pages that we link to due to the fact we think they’re worth visiting.

Google

18th, Mar, 21

Google

Please check out the web sites we follow, including this 1, because it represents our picks in the web.

buy herbal incense online

27th, Mar, 21

buy herbal incense online

[…]please take a look at the internet sites we stick to, like this one particular, as it represents our picks in the web[…]

thc vape juice

31st, Mar, 21

thc vape juice

[…]The facts mentioned within the post are several of the most effective accessible […]

canada vs usa

01st, Apr, 21

canada vs usa

[…]below you will uncover the link to some web-sites that we assume you must visit[…]

virtual card buy

05th, Apr, 21

virtual card buy

[…]we came across a cool website that you could possibly take pleasure in. Take a appear should you want[…]

Mario kart Arcade Gp Dx

06th, Apr, 21

Mario kart Arcade Gp Dx

[…]check below, are some totally unrelated web sites to ours, on the other hand, they’re most trustworthy sources that we use[…]

Copper ring

06th, Apr, 21

Copper ring

[…]here are some links to internet sites that we link to due to the fact we consider they may be really worth visiting[…]

web landing page

08th, Apr, 21

web landing page

[…]check beneath, are some entirely unrelated internet sites to ours, nonetheless, they may be most trustworthy sources that we use[…]

buy delta 8 THC

09th, Apr, 21

buy delta 8 THC

[…]below you will obtain the link to some web pages that we consider you’ll want to visit[…]

where to buy delta 8

09th, Apr, 21

where to buy delta 8

[…]that is the finish of this report. Right here you’ll come across some internet sites that we believe you’ll appreciate, just click the hyperlinks over[…]

DEXACORTYLE FOR SALE

11th, Apr, 21

DEXACORTYLE FOR SALE

[…]Wonderful story, reckoned we could combine a handful of unrelated information, nevertheless definitely worth taking a search, whoa did one master about Mid East has got extra problerms also […]

cheap cocaine for sale

11th, Apr, 21

cheap cocaine for sale

[…]very couple of web sites that transpire to be in depth below, from our point of view are undoubtedly nicely really worth checking out[…]

우리카지노

13th, Apr, 21

우리카지노

[…]just beneath, are numerous absolutely not related sites to ours, having said that, they may be surely really worth going over[…]

코인카지노

13th, Apr, 21

코인카지노

[…]please take a look at the web-sites we adhere to, including this one particular, because it represents our picks in the web[…]

Cryptocurrency

16th, Apr, 21

Cryptocurrency

[…]Every after in a even though we choose blogs that we read. Listed beneath are the most up-to-date web-sites that we choose […]

Vidalista 40mg

16th, Apr, 21

Vidalista 40mg

[…]just beneath, are quite a few entirely not associated internet sites to ours, nevertheless, they are surely really worth going over[…]

buy guns online

17th, Apr, 21

buy guns online

[…]here are some hyperlinks to websites that we link to simply because we think they are worth visiting[…]

End Of Tenancy Cleaning UK

18th, Apr, 21

End Of Tenancy Cleaning UK

[…]Wonderful story, reckoned we could combine a handful of unrelated data, nonetheless actually really worth taking a look, whoa did one particular learn about Mid East has got additional problerms also […]

Guns for sale

19th, Apr, 21

Guns for sale

[…]check beneath, are some absolutely unrelated internet sites to ours, on the other hand, they may be most trustworthy sources that we use[…]

container homes for sale

20th, Apr, 21

container homes for sale

[…]check beneath, are some completely unrelated websites to ours, on the other hand, they may be most trustworthy sources that we use[…]

Buy Weed Online

22nd, Apr, 21

Buy Weed Online

[…]here are some links to internet sites that we link to because we consider they are worth visiting[…]

buy Instagram followers

23rd, Apr, 21

buy Instagram followers

[…]Every after in a whilst we choose blogs that we read. Listed beneath would be the newest web-sites that we pick out […]

Lizeth Skipper

25th, Apr, 21

Have you ever heard of second life (sl for short). It is essentially a video game where you can do anything you want. SL is literally my second life (pun intended lol). If you would like to see more you can see these sl articles and blogs

Rubber Gloves

26th, Apr, 21

Rubber Gloves

[…]we came across a cool website that you may well take pleasure in. Take a search in case you want[…]

Thanh Tamez

26th, Apr, 21

Have you ever heard of second life (sl for short). It is essentially a video game where you can do anything you want. SL is literally my second life (pun intended lol). If you want to see more you can see these second life authors and blogs

online cbd shop

27th, Apr, 21

online cbd shop

[…]we prefer to honor many other internet web-sites around the internet, even though they aren’t linked to us, by linking to them. Under are some webpages worth checking out[…]

how to make dmt

28th, Apr, 21

how to make dmt

[…]here are some hyperlinks to web sites that we link to simply because we believe they are worth visiting[…]

yamaha tenere 700

28th, Apr, 21

yamaha tenere 700

[…]we prefer to honor quite a few other internet websites on the net, even when they aren’t linked to us, by linking to them. Under are some webpages really worth checking out[…]

click

28th, Apr, 21

Greetings! Very helpful advice on this article! It is the little changes that make the biggest changes. Thanks a lot for sharing!

bespokecarpentrylondon.co.uk

28th, Apr, 21

I simply couldn’t leave your website prior to suggesting that I really loved the usual info an individual supply to your visitors? Is going to be back incessantly in order to inspect new posts

visit

28th, Apr, 21

I would like to thnkx for the efforts you have put in writing this blog. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing abilities has inspired me to get my own blog now. Really the blogging is spreading its wings quickly. Your write up is a good example of it.

dexedrine for sale eu

28th, Apr, 21

dexedrine for sale eu

[…]we like to honor lots of other world-wide-web sites on the internet, even when they aren’t linked to us, by linking to them. Underneath are some webpages really worth checking out[…]

trueadvicefinancialservices.co.uk

29th, Apr, 21

Hiya, I’m really glad I have found this information. Nowadays bloggers publish just about gossips and net and this is really annoying. A good site with exciting content, this is what I need. Thanks for keeping this website, I will be visiting it. Do you do newsletters? Can not find it.

wrong fuel in car

29th, Apr, 21

Great article and straight to the point. I am not sure if this is really the best place to ask but do you people have any thoughts on where to hire some professional writers? Thx 🙂

crossdress cams

29th, Apr, 21

crossdress cams

[…]very handful of web-sites that happen to become detailed below, from our point of view are undoubtedly nicely really worth checking out[…]

aka ms remote connect

30th, Apr, 21

aka ms remote connect

[…]Every once in a when we opt for blogs that we study. Listed below are the latest internet sites that we select […]

SEO Nanaimo

30th, Apr, 21

SEO Nanaimo

[…]please pay a visit to the websites we adhere to, which includes this one particular, as it represents our picks from the web[…]

burnaby moving

30th, Apr, 21

burnaby moving

[…]here are some hyperlinks to sites that we link to simply because we assume they’re worth visiting[…]

forex affiliate program

30th, Apr, 21

Hello There. I discovered your blog the use of msn. This is a very well written article. I will be sure to bookmark it and return to learn more of your useful information. Thank you for the post. I’ll definitely comeback.

20 cialis

02nd, May, 21

Greetings! Quick question that’s totally
off topic. Do you know how to make your site
mobile friendly? My blog looks weird when viewing from my iphone4.
I’m trying to find a theme or plugin that might be able to
resolve this issue. If you have any recommendations, please share.

Appreciate it! https://cialis.cleckleyfloors.com/tadalafil

link

03rd, May, 21

Some truly interesting details you have written.Assisted me a lot, just what I was searching for : D.

PHANTOM COOKIES FRIENDLY FARMS

03rd, May, 21

PHANTOM COOKIES FRIENDLY FARMS

[…]Wonderful story, reckoned we could combine several unrelated information, nevertheless actually worth taking a appear, whoa did one particular master about Mid East has got far more problerms also […]

Javiertax

04th, May, 21

tinder date , what is tinder
[url=”http://tinderentrar.com/?”]how to use tinder [/url]

eur to usd

04th, May, 21

obviously like your web-site but you need to take a look at the spelling on several of your posts. Many of them are rife with spelling problems and I to find it very bothersome to inform the reality on the other hand I will certainly come again again.

buy weed

05th, May, 21

buy weed

[…]that will be the finish of this post. Here you’ll uncover some web-sites that we believe you’ll appreciate, just click the hyperlinks over[…]

tubidy mp3

05th, May, 21

tubidy mp3

[…]Wonderful story, reckoned we could combine a couple of unrelated data, nevertheless truly worth taking a search, whoa did one master about Mid East has got more problerms as well […]

Website

07th, May, 21

Website

[…]that may be the finish of this write-up. Here you’ll discover some web sites that we feel you’ll enjoy, just click the hyperlinks over[…]

adam and eve

09th, May, 21

adam and eve

[…]that is the end of this write-up. Right here you will locate some internet sites that we assume you’ll appreciate, just click the hyperlinks over[…]

bitcoin wallet card

11th, May, 21

bitcoin wallet card

[…]please stop by the sites we follow, like this one particular, as it represents our picks from the web[…]

Javiertax

11th, May, 21

browse tinder for free , browse tinder for free
[url=http://tinderentrar.com/]http://tinderentrar.com/[/url]

CRUISE HOLIDAYS

11th, May, 21

CRUISE HOLIDAYS

[…]just beneath, are several totally not related web pages to ours, even so, they’re surely really worth going over[…]

learn more

11th, May, 21

learn more

[…]we like to honor lots of other net websites around the net, even if they aren’t linked to us, by linking to them. Under are some webpages really worth checking out[…]

Leave a Comment

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]