Tag Info

Hot answers tagged

10

You should be loading jQuery with wp_enqueue_script('jquery') - that way, you won't end up with multiple instances if plugins try to load it too. To use Google CDN, place this in your functions.php; wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', array(), '1.5.1'); Update: ...


9

The problem is that I'm pretty sure is impossible check if css is effectively added to page via PHP: css is parsed by browser, so client side, and has completely no effect on server side. Of course, in PHP is possible check if CDN is responsive or not... Option 1 Send a request and if it responds with http status 200, use it. Something like: function ...


8

You need to either Version your files (by calling it style.css?ver=xxx.xxx) and making sure your CloudFront distribution has "Forward Query strings" turned on. This is the better option, as it means that all you need to do is increment the number in the query string and CloudFront will fetch this file automatically. Manually invalidate your files via the ...


6

This can be broken down to a simple task by adding a custom filter. You will need to add the following to the _send_request method within the CF_Http class in cloudfiles_http.php line 1283. $headers = $this->_make_headers($hdrs); //Add this line below $headers = apply_filters('cloudfiles_headers', $headers, $url_path, $method); This will give you ...


6

I remove version like this, can be easily written out to match multiple domains: add_filter( 'script_loader_src', 'jquery_unversion' ); function jquery_unversion( $src ) { if( strpos( $src, 'ajax.googleapis.com' ) ) $src = remove_query_arg( 'ver', $src ); return $src; }


5

Most CDNs (including Amazon's Cloudfront, which is what I've used), allow origin pull, which essentially means that the CDN pulls the required entity from, in this case, your blog, the first time someone tries to access it. If use a caching plugin like wp-supercache, or w3 total cache, they integrate with CDNs like Cloudfront to manage much of this for you. ...


5

There's a pretty simply "trick" to prevent caching, when file contents changed: Add a version number, that is set to the latest date/time you changed your file. add_action( 'wp_enqueue_scripts', 'wpse61738_non_cached_stylesheet' ); function wpse61738_non_cached_stylesheet() { wp_enqueue_style( 'style-main', ...


4

In WordPress Dashboard > Settings > Media and fill the field "Full URL path to files" with your other domain. See the screenshot below: EDIT: I thought it would be obvious, but it isn't. Here's what you exactly need to do: You should map your domain to point to: public_html directory, IF it's also your WordPress installation's root directory. ...


4

Its not recommended often enough, but Flickr is an excellent image host for blogs as well. Their pro account costs only $25/year. You get unlimited image, video uploads and no bandwidth limit. If you don't want your blog image uploads populating your personal photostream, you can easily create a separate account for it. You can easily streamline your ...


4

You have to balance speed optimization with reality. That means don't obsess over speed analytics, there is one thing you should be looking at in terms of satisfying users, load time (in most cases). Test your page un-cached and then cached, you should see a noticeable difference in how fast they load, for me your site is loading around 2.5 seconds, that ...


4

There is no remotely easy way to accomplish this with "push" strategy, because (unlike attachments) plugins and themes do not really declare their resources to WordPress. To push those resources you need to enumerate them and keep that information up to date. In pull configurations this happens automagically in actual use. For push configuration you will ...


3

The W3 Total Cache plugin changes the URL of various files in /w3-total-cache/lib/W3/Plugin/Cdn.php in the function *ob_callback*. It uses a series of callbacks to modify an output buffer. The code runs like this: w3_total_cache.php calls $root->run(); W3_Root::run calls $plugin->run() for each plugin in $this->_loaded_plugins ...


3

I'm probably overcomplicating things. Right now, you are. As I have no traffic as of now I don't really need to do this, but .... I don't know what to choose as I don't understand what these services really do, other than it's supposed to be "better" to host externally... Then why bother with a CDN right now and all of the image hosting ...


3

Amazon CloudFront Amazon CloudFront is an CDN 'wrapper' around Amazon's S3 service. Distributions can be created from existing S3 buckets, and when a file is requested from it's CloudFront URL it is either served from the nearest edge locations's cache or fetched from S3 and cached. Plugins My CDN - handles URL rewriting of JS, CSS, and other theme ...


3

I think the W3 Total Cache Plugin can help you..


3

The plugin works fine; alternative you can use a own function to replace the bloginf() to your CDN-Url; Example: replace the url in content: // replace content for CDN if ( !function_exists('fb_add_static_content_url') ) { function fb_add_static_content_url($content) { if ( is_admin() ) // eigentlich überflüssig return ...


2

Rackspace Cloud Files You can sign up for Rackspace Cloud files, and pay only what you use, this can be a good way to start out, as you don't need to pay upfront for a large amount of bandwidth, that you may or may not use. There are two plugins that work well with Wordpress and Cloud Files, Cloud Tools plugin. This is a plugin by Paul Kehrer, it'll ...


2

Scripts don't get printed at the wp_enqueue_scripts hook, but rather at the wp_print_scripts hook. That said: don't echo/print scripts, period. Instead, enqueue them properly. Caveat: This method is Plugin territory, and should not be included as Theme code in a publicly distributed Theme. You deregister jQuery, but the step you're missing is registering ...


2

You can run all your posts on CDN, previous and new. In case CDN works on Origin Pull it is not a problem. As far as I know lot of pay as you go providers have this option, and it is no problem to switch back anytime. More about how Push and Pull CDN works here I am using CDN77 and they have easy manual on how to integrate their CDN with wordpress


2

Your first issue is the fact that you're on shared hosting. The fact that 1,195 websites are using the same IP address is a dead giveaway. You're likely running into resource limits with your hosting provider. Second is a misconception of what caching does to optimize a site. Caching helps clean up and optimize load times on the front-end of your site. ...


2

I addition to the methods you have mentioned, the biggest way to speed up your loading time is with a caching plugin. There are many in the WordPress Plugin Directory, but my favorite is Quick Cache.


2

It depends what you mean, entirely on Cloudfront. Cloudfront is a CDN only. It can't run any server side scripting environments (PHP or MySQL), it therefore isn't possible to host a wordpress site entirely with Cloudfront. You could alternatively use Cloudfront to host your images to improve speed. The closest way to host a wordpress site entirely on ...


2

It may seem a bit of an odd question ... but it does have a bit of an easy answer. I've been using W3 Total Cache on a multi-server setup for WordPress for 6+ months. For this project we decided to use memcached and not varnish. About WC Total Cache and CDN In W3 Total Cache you only sync static files like the theme files, CSS and images to the CDN. ...


2

The easiest way to go would be to use an "Origin Pull" CDN. These sorts of delivery networks pull media directly from your site, cache it (usually for the TTL defined by your Cache related HTTP headers). Any origin pull CDN will work fine with multi-site. You rewrite all static resource URLs in your content to the CDN, when the page loads, the resources ...


2

WordPress has a number of implicit assumptions with regards to using SSL. Specifically, if you are using force_ssl_admin, and the "front" of your site has the same domain as the "back" does, then it assumes that your entire site is actually accessible either via http or https. This happens in a few different places. Most notably, the Theme Customizer ...


1

You could try something like this to test the CDN version first and then load conditionally based on if it is available or not: $get_the_url = 'http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js'; $test_the_url = @fopen( $get_the_url,'r' ); if ( $test_the_url !== false ) { function load_external_bootstrap() { ...


1

I've taken the previous post and done 2 things with it: uses native WordPress http call functions cache the fact that the CDN is up for 20 minutes (you can tweak this). You really don't want to get the CDN content on EVERY page load. No point in speeding up your site with CDNs when you do that. $get_the_url = ...


1

Yes, making static version of WP blog is definite possibility. I would advise against using caching plugins for that — it's not their purpose and a lot of their functionality tends to depend on elaborate rewrite rules, which you won't be able to replicate on CDN. There are dedicated WP solutions (none that I have tried), but using generic tool for making ...


1

CDN is for static content and if your client intends to update his site 3 times a day then the site's content is very far from being static. It probably can be done, I think there are plugins that can generate static site from wordpress and you don't need to use plugins which are designed for other tasks, and after you generated a static site you can push ...


1

Figured it out. Looking at wp-comments-post.php there is a filter called comment_post_redirect which I used to check if the comment was approved and then added a query string to the URL. So easy. //A query string needs to be added when redirecting back to the post after a comment is posted and not approved. This ensures the page with the "Your comment is ...



Only top voted, non community-wiki answers of a minimum length are eligible