to add at your plugin function file
// to add at your plugin function file
function adding_page_template ($templates)
{
$trainingTimer = WP_PLUGIN_DIR . '/myrules/3rdParty/trainingTimer/trainingTimer.php';
$templates[$trainingTimer] = 'trainingTimer';
return $templates;
}
add_filter ('theme_page_templates', 'adding_page_template');
function redirect_page_template ($template)
{
global $wp_query;
$template = get_post_meta($wp_query->post->ID,'_wp_page_template',true);
if (basename($template) === 'trainingTimer.php') {
return ($template)?$template:'Error loading the template';
}
}
add_filter ('page_template', 'redirect_page_template');