I am creating a custom wordpress plugin.
Where for some pages like
i will append my template code from my plugin folder. Which mean i will include my custom template not even related to wordpress theme.
my code will look like this inside my wordpress plugin page.
if ( $wp->query_vars('pagename')=="clinic"){
include(MYPLUGINPATH . '/template/clinic.php');
die();
}else if($wp->query_vars('pagename')=="pharmacy"){
include(MYPLUGINPATH . '/template/clinic.php');
die();
}
But $wp-query_vars('pagename') return null.is there a way to get the current loading wordpress pagename inside the plugin code.
$wp
? Are you using that code in some action hook? If so, which one?