danlapteacru/facetwp-local-json

将 FacetWP 的面版、模板和设置保存为 .json 文件,存储在您的主题中。

安装: 0

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

类型:wordpress-plugin

0.1.0 2024-07-29 06:59 UTC

README

FacetWP Local JSON 是一款 WordPress 插件,允许您将 FacetWP 的面版、模板和设置保存为 .json 文件,并存储在源代码仓库中。

Packagist Version PHP from Packagist Packagist Downloads GitHub License Hire Me

最低要求

  • 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 JSONDan Lapteacru 创建。

所有贡献者的完整列表可以在 这里 找到。

许可证

FacetWP Local JSONMIT 许可证 下发布。