alexrah/wp-page-template-loader

注入页面模板和模板部分的辅助类

1.2.0 2024-02-13 23:28 UTC

This package is auto-updated.

Last update: 2024-09-14 00:59:30 UTC


README

用于在WP插件中注入模板部分和页面模板的辅助类

用法

在插件目录中创建以下目录

  • template-pages
  • template-parts

在主插件文件中初始化类

new WpPageTemplateLoader(__FILE__,$aOpts);

可用的 $aOpts 选项

  • filter_prefix:为过滤器和动作钩子定义一个自定义前缀,默认为$sPluginRootFile
  • theme_template_directory:定义当前主题内部用于扫描模板部分的文件夹名称,默认为none
  • plugin_template_pages_directory:定义插件内部存储页面模板的文件夹名称,默认为template-pages
  • plugin_template_parts_directory:定义插件内部存储模板部分的文件夹名称,默认为template-parts

使用Composer安装

composer require alexrah/wp-admin-custom-post-types

在Packagist上发布于:https://packagist.org.cn/packages/alexrah/wp-admin-custom-post-types

变更日志

版本 1.0.0

  • 注入模板部分和页面模板的辅助类

致谢