이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

Appcachify

설명

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:

  1. adds URLs of all queued scripts and styles
  2. searches theme files and folder for any images or other static assets
  3. if a theme has a 307.php template it is used as an offline fallback
  4. 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.

  1. The current theme (and version if available)
  2. The most recent modified time of any files we find the server path for
  3. 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:

설치

Upload the plugin to your plugins directory and activate it. There’s no configuration involved or settings screen.

후기

모든 2 평가 읽기

기여자 & 개발자

“Appcachify”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “Appcachify”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

1.0

  • Initial commit to wordpress.org