Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Aug 8, 2016
1 parent 97f3663 commit e08290a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,38 @@ Allow Customizer states to be drafted, and previewed with a private URL.
Customize Snapshots save the state of a Customizer session so it can be shared or even published at a future date. A snapshot can be shared with a private URL to both authenticated and non authenticated users. This means anyone can preview a snapshot's settings on the front-end without loading the Customizer, and authenticated users can load the snapshot into the Customizer and publish or amend the settings at any time.

Requires PHP 5.3+. **Development of this plugin is done [on GitHub](https://github.com/xwp/wp-customize-snapshots). Pull requests welcome. Please see [issues](https://github.com/xwp/wp-customize-snapshots) reported there before going to the [plugin forum](https://wordpress.org/support/plugin/customize-snapshots).**
### Persistent Object Caching ###
Plugins and themes may currently only use `is_customize_preview()` to
decide whether or not they can store a value in the object cache. For
example, see `Twenty_Eleven_Ephemera_Widget::widget()`. However, when
viewing a snapshot on the frontend, the `is_customize_preview()` method
will return `false`. Plugins and themes that store values in the object
cache must either skip storing in the object cache when `CustomizeSnapshots\is_previewing_settings()`
is `true`, or they should include the `CustomizeSnapshots\current_snapshot_uuid()` in the cache key.

Example of bypassing object cache when previewing settings inside the Customizer preview or on the frontend via snapshots:

```php
if ( function_exists( 'CustomizeSnapshots\is_previewing_settings' ) ) {
$bypass_object_cache = CustomizeSnapshots\is_previewing_settings();
} else {
$bypass_object_cache = is_customize_preview();
}
$contents = null;
if ( ! $bypass_object_cache ) {
$contents = wp_cache_get( 'something', 'myplugin' );
}
if ( ! $contents ) {
ob_start();
myplugin_do_something();
$contents = ob_get_clean();
echo $contents;
}
if ( ! $bypass_object_cache ) {
wp_cache_set( 'something', $contents, 'myplugin', HOUR_IN_SECONDS );
}
```


## Screenshots ##

Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Customize Snapshots save the state of a Customizer session so it can be shared o

Requires PHP 5.3+. **Development of this plugin is done [on GitHub](https://github.com/xwp/wp-customize-snapshots). Pull requests welcome. Please see [issues](https://github.com/xwp/wp-customize-snapshots) reported there before going to the [plugin forum](https://wordpress.org/support/plugin/customize-snapshots).**

=== Persistent Object Caching ===
= Persistent Object Caching =

Plugins and themes may currently only use `is_customize_preview()` to
decide whether or not they can store a value in the object cache. For
Expand All @@ -27,7 +27,7 @@ is `true`, or they should include the `CustomizeSnapshots\current_snapshot_uuid(

Example of bypassing object cache when previewing settings inside the Customizer preview or on the frontend via snapshots:

<pre lang=php>
<pre lang="php">
if ( function_exists( 'CustomizeSnapshots\is_previewing_settings' ) ) {
$bypass_object_cache = CustomizeSnapshots\is_previewing_settings();
} else {
Expand Down

0 comments on commit e08290a

Please sign in to comment.