2017 © Pedro Peláez
 

library template

Load template files with autosearch and support for multilanguage folder for email template

image

wpbp/template

Load template files with autosearch and support for multilanguage folder for email template

  • Wednesday, November 8, 2017
  • by Mte90
  • Repository
  • 1 Watchers
  • 1 Stars
  • 303 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

Template

License Downloads, (*1)

Templating system in WordPress (woocommerce like) also for email with l10n support., (*2)

  • Your plugin will be able to provide a templates folder 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, (*3)

composer-php52 supported., (*4)

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., (*5)

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, (*6)

wpbp_get_email_template is a function that looks for folder like en_US with file's extension .tpl., (*7)

The code is very easy and in case of doubts you can check here., (*8)

The Versions

08/11 2017

dev-master

9999999-dev https://github.com/WPBP/Template

Load template files with autosearch and support for multilanguage folder for email template

  Sources   Download

GPL-3.0

wordpress email template

08/11 2017

1.0.2

1.0.2.0 https://github.com/WPBP/Template

Load template files with autosearch and support for multilanguage folder for email template

  Sources   Download

GPL-3.0

wordpress email template

05/09 2016

1.0.1

1.0.1.0 https://github.com/WPBP/Template

Load template files with autosearch and support for multilanguage folder for email template

  Sources   Download

GPL-3.0

wordpress email template

22/06 2016

1.0.0

1.0.0.0 https://github.com/WPBP/Template

Load template files with autosearch and support for multilanguage folder for email template

  Sources   Download

GPL-3.0

wordpress email template