Horje Website

Image cache - Configuring WordPress for Amazon CloudFront Caching? in WordPress
Wordpress

 

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 $content;

            $wpurl = get_bloginfo('wpurl');

            $search = array(
                $wpurl . '/wp-content/images/',
                $wpurl . '/wp-content/download/',
            );

            $replace = array(
                'http://cdn1.bueltge.de/',
                'http://cdn2.bueltge.de/',
            );

            return str_replace( $search, $replace, $content );
    }
    add_filter( he_content', 'fb_add_static_content_url' );
}

replace stylesheet_directoy and others:


// replace for CDN
if ( !function_exists('fb_add_static_wpurl') ) {
    function fb_add_static_wpurl($info, $show) {

        if ( is_admin() )
            return $info;

        $keys = array(
            'url',
            'wpurl',
            'stylesheet_url',
            'stylesheet_directory',
            emplate_url',
            emplate_directory',
            );

        if ( in_array( $show, $keys ) ) {

            $wpurl = get_bloginfo('wpurl');

            $search = array(
                $wpurl . '/wp-content/images/',
                $wpurl . '/wp-content/download/',
                $wpurl . '/wp-content/themes/',
                $wpurl . '/wp-content/plugins/',
            );

            $replace = array(
                'http://cdn1.bueltge.de/',
                'http://cdn2.bueltge.de/',
                'http://cdn3.bueltge.de/',
                'http://cdn3.bueltge.de/',
            );

            return str_replace( $search, $replace, $info );

        } else {
            return $info;
        }
    }
    add_filter( 'bloginfo_url', 'fb_add_static_wpurl', 9999, 2 );
}

replace the template_directory and other:


function fb_add_static_stylesheet_uri($uri) {

            if ( is_admin() )
                return $uri;

            $wpurl = get_bloginfo('wpurl');

            $search = array(
                $wpurl . '/wp-content/images/',
                $wpurl . '/wp-content/download/',
                $wpurl . '/wp-content/themes/',
                $wpurl . '/wp-content/plugins/',
            );

            $replace = array(
                'http://cdn1.bueltge.de/',
                'http://cdn2.bueltge.de/',
                'http://cdn3.bueltge.de/',
                'http://cdn3.bueltge.de/',
            );
            return str_replace( $search, $replace, $uri );

}
add_filter ( emplate_directory_uri', 'fb_add_static_stylesheet_uri' );
add_filter ( 'stylesheet_uri', 'fb_add_static_stylesheet_uri' );
add_filter ( 'stylesheet_directory_uri', 'fb_add_static_stylesheet_uri' );


Presented by: Wordpress/Stackoverflow
Similar Tutorials
  cache - Configuring WordPress for Amazon CloudFront Caching? in WordPress
  plugins - Plug-in Conflict: Art Direction and Super Cache in WordPress
  cache - Is it possible to save an entire piece of rendered HTML in a transient? in WordPress
  What archive plugin works with W3 total cache? in WordPress
  cache - How to find time last viewed? in WordPress
  plugins - "W3 Total Cache" with "What Would Seth Godin Do" (and widgets?!)? in WordPress
  W3 total cache - cache refresh programmatically in WordPress
  widgets - Can I ignore caching of a plugin in W3 Total Cache? in WordPress
  filters - What hooks to hook onto for automatic cache clearing in WordPress
  cache - Optimize apache for WP use in WordPress

 


 

Horje © 2011 - 2024