Plugin / Appcachify
Robert O'RourkeDescription
Description
The plugin adds an iframe to the footer of your website which points to example.com/manifest
.
That URL is an empty page that references the generated manifest file at example.com/manifest.appcache
.
The manifest itself is built in the following way:
- adds URLs of all queued scripts and styles
- searches theme files and folder for any images or other static assets
- if a theme has a 307.php template it is used as an offline fallback
- a timestamp of the most recently modified file is added to force appcache to refresh
The net result of all this is that your main static files are stored locally on your visitors devices. For mobile this greatly helps to improve download and rendering times.
Documentation
Adding items to the manifest
Appcache can do more than store static assets. You could cache entire pages, or add fallbacks for when a user is offline.
There are 3 main sections to a manifest:
CACHE
The main CACHE
section is for URLs that should be explicitly cached.
<?php
add_filter( 'appcache_cache', function( $urls ) {
$urls[] = '/page-available-offline/';
return $urls;
} );
?>
NETWORK
This section is for specifying URLs that should never be cached.
<?php
add_filter( 'appcache_network', function( $urls ) {
$urls[] = '*';
$urls[] = '/online-only-page/';
return $urls;
} );
?>
FALLBACK
The fallback section allows you to set fallback pages or images if the user is offline.
<?php
add_filter( 'appcache_fallback', function( $patterns ) {
$patterns[] = 'wp-content/uploads/ wp-content/uploads/offline.jpg';
return $patterns;
} );
?>
The update header
Appcaches are refetched when the manifest file content changes so we add a few items as comments at the top of the file.
- The current theme (and version if available)
- The most recent modified time of any files we find the server path for
-
The size of all the files that we find a server path for
get_var( “SELECT post_modified FROM $wpdb->posts WHERE post_type = ‘post’ ORDER BY post_modified DESC LIMIT 1” );
return $headers;
} );
?>
More about appcache
I strongly recommend learning more about what you can do with appcache by reading the following articles:
Ratings
Rating breakdown
Details Information
Version
First Released
Total Downloads
Wordpress Version
Tested up to:
Require PHP Version:
Tags
Contributors
Languages
The plugin hasn't been transalated in any language other than English.
DIRECTORY DISCLAIMER
The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.
The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.
Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.
While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.
wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.