wpbp/template
最新稳定版本:1.0.4
Composer 安装命令:
composer require wpbp/template
包简介
Load template files with autosearch and support for multilanguage folder for email template
关键字:
README 文档
README
Templating system in WordPress (woocommerce like) also for email with l10n support.
- Your plugin will be able to provide a
templatesfolder that will be loaded by the plugin - If a theme has a folder with the same slug name of the plugin will look if the file exist there
Install
composer require wpbp/language:1.0.1
composer-php52 supported.
Example
// This is like the woocommerce function function load_content_demo( $original_template ) { if ( is_singular( 'demo' ) && in_the_loop() ) { return wpbp_get_template_part( 'plugin-name-folder', 'content', 'demo', false, array() ); // The last parameter is for arguments to pass to the template but is not mandatory } else { return $original_template; } } add_filter( 'template_include', 'load_content_demo' ); // This is an extended version that search for folder with names based on locales like it_IT $get_template_email = wpbp_get_template_part( 'plugin-name-folder' , 'header', 'prefix' );
In this case will look for a content-demo.php file.
wpbp_get_template_part is the same of https://developer.wordpress.org/reference/hooks/get_template_part/ this filter, the difference is that this one is executed by this library
wpbp_get_email_template is a function that looks for folder like en_US with file's extension .tpl.
The code is very easy and in case of doubts you can check here.
统计信息
- 总下载量: 24.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-06-22