November 2013
Beginner to intermediate
376 pages
9h
English
First, we have to add a function to the WP_Theme class of the plugin to include the template loader file, as shown in the following code. Also, we have to update the constructor to call the template_init function upon plugin initialization:
public function template_init() {
include_once 'class-wpwa-template-loader.php';
}Create a new file named class-wpwa-template-loader.php inside the plugin class to implement the template loader. Let's implement the loader by creating a new class named WPWA_Template_Loader inside the class-wpwa-template-loader.php file:
class WPWA_Template_Loader{ private $template_dir; public function __construct(){ $this->template_dir = "templates"; } public function render($name,$data = array() ...Read now
Unlock full access