/** * Returns an instance of this class. An implementation of the singleton design pattern. * * @return Page_Templae_Example A reference to an instance of this class. * @since 1.0.0 */ public static function get_instance() { if (null == self::$instance) { self::$instance = new Page_Template_Plugin(); } // end if return self::$instance; }
<?php /** * Template Name: Example Page Template II * * The second template used to demonstrate how to include the template * using this plugin. * * @package PTE * @since 1.0.0 * @version 1.0.0 */ ?> <?php $pte = Page_Template_Plugin::get_instance(); $locale = $pte->get_locale(); ?> <h1><?php _e('This is another example template.', $locale); ?> </h1>