WP Manifestindependent plugin directory
manifest / developer / facetwp-local-json

Local JSON for FacetWP

Saves FacetWP facets, templates and settings as .json files within your theme.

★ 4stars
0.1.0latest · 2 years ago

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/danlapteacru/facetwp-local-json/archive/refs/heads/main.zip

On Packagist as danlapteacru/local-json-for-facetwp:

composer require danlapteacru/local-json-for-facetwp
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

FacetWP Local JSON is a WordPress plugin that allows you to store FacetWP facets, templates and settings as .json file and keep them in your source code repository.

Minimum Requirements

  • PHP v8.1
  • WordPress v6.1
  • FacetWP v4.0

Installation

Composer (Recommended)

composer require danlapteacru/facetwp-local-json

WP-CLI

wp plugin install facetwp-local-json --activate

wordpress.org plugins directory

Download from https://wordpress.org/plugins/facetwp-local-json and install it manually or via WordPress admin panel.

Hooks

facetwp_local_json_settings

Filter the settings that are stored in the .json file.

Example:

add_filter(
    'facetwp_local_json_settings', 
    fn (array $settings): array => [
        ...$settings,
        $settings['general']['auto_refresh'] = true,
    ],
);

facetwp_local_json_storage_path

Filter the path where the .json files are stored. Default is wp-content/themes/your-theme/plugins/facetwp/local-json/settings.json.

Example:

add_filter(
    'facetwp_local_json_storage_path', 
    fn (): string => get_theme_file_path('facetwp/settings.json'),
);

Constants

FACETWP_LOCAL_JSON_STORAGE_PATH

Define the path where the .json files are store in your wp-config.php file.

Example:

define('FACETWP_LOCAL_JSON_STORAGE_PATH', get_theme_file_path('facetwp/settings.json'));

FACETWP_LOCAL_JSON_FORCE_ENABLE

Force enable/disable the FacetWP Local JSON features.

Example:

define('FACETWP_LOCAL_JSON_FORCE_ENABLE', true);

TODO

  • [ ] Add support for WPML and Polylang.
  • [ ] Option to select which facets, templates and settings to store in the .json file.
  • [ ] Tests.
  • [ ] Documentation.

Credits

FacetWP Local JSON is created by Dan Lapteacru.

Full list of contributors can be found here.

License

FacetWP Local JSON is released under the MIT License.

Releases

1 release.

Tag
Published
0.1.0 latest
Jul 29, 2024 2 years ago

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.