Wordpress cdn activation

I use Elegant themes on Wordpress. They have told me that I need to put the following 3 entries in functions.php for #1, and into the style scripts for #2 & #3 what do I input (the cloudflare address 1x1x.yourcdn.com … )
Can someone rewrite the following code for me with the cloudflare bits added;
#1
function cdn_url() {

return 'http://1x1x.yourcdn.com/wp-content/uploads' ;

}

add_filter( 'pre_option_upload_url_path' , 'cdn_url' );

#2
//This code loads the stylesheet from the CDN

function enqueue_my_styles() {

wp_register_style( 'my-styles' , 'http://1x1x1x1x.yourcdn.com/blog/wp-content/themes/yourtheme/style.css' );

wp_enqueue_style( 'my-styles' );

}

add_action( 'wp_enqueue_scripts' , 'enqueue_my_styles' );

#3
//This code loads our JavaScript file from the CDN

function enqueue_my_scripts() {

wp_register_script( 'my-scripts' , 'http://1x1x1x1x.yourcdn.com/blog/wp-content/themes/yourtheme/scripts.js' );

wp_enqueue_script( 'my-scripts' );

}

add_action( 'wp_enqueue_scripts' , 'enqueue_my_scripts' );

I am afraid, as I mentioned earlier, that is Wordpress specific and is better discussed in a Wordpress related forum. You could also check out StackExchange.

There are no “Cloudflare bits”. Cloudflare tunnels whatever you send through it.

Im referring to this; yourcdn.com what do I put for cdn? … do I put “cloudflare.com”?
My theme (Elegant themes are telling me to ask Cloudflare)
Im going in circles between everyone

Cloudflare is no CDN, hence there is also no such URL. You specify your own domain wherever necessary.

Sandro - please dont close a thread … my theme has instructed me to confirm with you guys what to put

Please refer to my earlier reply.

No CDN ??? https://www.cloudflare.com/cdn/
Am I using the wrong terminology? Apologies

That’s Cloudflare’s relatively misleading marketing material.

Cloudflare is no CDN in the strict definition. As I said earlier you need to use your own domain.

ok… thanks for you help again

Cloudflare is a reverse proxy based CDN where whole example.com is normally suppose to use provided nameservers.

image

Read this https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/

What are showing above code is suitable for a different kind of CDN which is known as PullZone CDN, such CDN works differently. That’s not Cloudflare.

In case of Cloudflare, you are not suppose to put such standalone hostname cdn.example.com like that… but just add example.com to Cloudflare and follow its instructions.

However if you wish to keep cdn.example.com as a seperate hostname then you need a new domain (as an alias) but I am afraid it could be violation of usage terms 2.8. If you’ve any file delivery (non-html) serving use case, better contact Cloudflare support before deployment.

1 Like

Thank you @user3996, can you please forward your comment on my last post to @sandro ??? Maybe he should read this to not just shrug a new member off next time - we are all here to get CF working right? So if I use the terminology CDN … CDN …yes thats right CDN and I say I use a HOST …SITEGROUND… what am I doing …Im using CF as a REVERSE PROXY …@sandro; maybe read this https://www.cloudflare.com/cdn/
*** thank you CF - you have been absolutely of no help for me in the last few days.
Sandro - please do not comment to any of my posts

We should be done here actually. Your question was answered already an hour ago.

Nobody shrugged anything off, but if you had used the search in the first place you wouldn’t have asked that question as that came up quite a few times already anyhow.

As I already said an hour ago, Cloudflare is not a CDN and does not provide any URLs. You always need to use your own domain. I believe I had made that clear already an hour ago, plus you should check out support.cloudflare.com.

But don’t worry, as you asked I won’t respond to your future threads any more :wink:

This topic was automatically closed after 20 minutes. New replies are no longer allowed.