In the case of a plugin template, you might find the slug is more reliable for a condition – see below for alternate approach.
When using is_page_template()
the parameter passed is anypath/filename.php
. Without knowing your file system specifics or the name of the plugin, it is impossible to give you the correct relative path for this. Use plugin_dir_path()
to get the plugin root, then subfolder, etc for this approach.
Alternate Approach
Or go with get_page_template_slug()
to eliminate the need to know the template location as it only returns the page template filename.
$template = get_page_template_slug(); // You may need to pass the post ID depending on context
if ( 'profile.php' === $template ) {
echo 'yes';
} else {
echo 'no';
}
WP Codex for more info: https://developer.wordpress.org/reference/functions/get_page_template_slug/
https://developer.wordpress.org/reference/functions/plugin_dir_path/