danlapteacru / facetwp-local-json
将 FacetWP 的面版、模板和设置保存为 .json 文件,存储在您的主题中。
0.1.0
2024-07-29 06:59 UTC
Requires
- php: ^8.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-19 23:11:07 UTC
README
FacetWP Local JSON 是一款 WordPress 插件,允许您将 FacetWP 的面版、模板和设置保存为 .json 文件,并存储在源代码仓库中。
最低要求
- PHP v8.1
- WordPress v6.1
- FacetWP v4.0
安装
Composer(推荐)
composer require danlapteacru/facetwp-local-json
WP-CLI
wp plugin install facetwp-local-json --activate
wordpress.org 插件目录
从 https://wordpresstheme.cn/plugins/facetwp-local-json 下载并手动安装,或通过 WordPress 管理面板安装。
钩子
facetwp_local_json_settings
筛选存储在 .json 文件中的设置。
示例
add_filter( 'facetwp_local_json_settings', fn (array $settings): array => [ ...$settings, $settings['general']['auto_refresh'] = true, ], );
facetwp_local_json_storage_path
筛选 .json 文件存储的路径。默认为 wp-content/themes/your-theme/plugins/facetwp/local-json/settings.json
。
示例
add_filter( 'facetwp_local_json_storage_path', fn (): string => get_theme_file_path('facetwp/settings.json'), );
常量
FACETWP_LOCAL_JSON_STORAGE_PATH
在您的 wp-config.php
文件中定义 .json 文件存储的路径。
示例
define('FACETWP_LOCAL_JSON_STORAGE_PATH', get_theme_file_path('facetwp/settings.json'));
FACETWP_LOCAL_JSON_FORCE_ENABLE
强制启用/禁用 FacetWP Local JSON 功能。
示例
define('FACETWP_LOCAL_JSON_FORCE_ENABLE', true);
待办事项
- 支持 WPML 和 Polylang。
- 可以选择将哪些面版、模板和设置存储在 .json 文件中。
- 测试。
- 文档。
鸣谢
FacetWP Local JSON 由 Dan Lapteacru 创建。
所有贡献者的完整列表可以在 这里 找到。
许可证
FacetWP Local JSON 在 MIT 许可证 下发布。