I am using this little technique outlined here :
https://mekshq.com/include-javascriptonly-on-specific-wordpress-page-templates/
to limit the quantity of scripts etc. which load up on different pages on my site, by using the code:
$template_name = get_post_meta( $wp_query->post->ID, '_wp_page_template', true );
if($template_name == 'my-custom-template.php'){
//load my scripts
}
But I would like to use the same technique for POST templates, however '_wp_page_template' doesn't seem to recognize post templates, just page templates.
Is there some way I can change this to query if it is a post template instead? If not can I at least query if it is a post rather than a page, irrespective of template? That would probably be good enough, although querying the template would be preferable as it would give me more flexibility going forward.
I tried to look it up but sry, I am really not very strong in .php and most of the imfo I found is too complicated for me to rly follow.... like here there is a lot of info but it's like a week long lesson for me :/
https://codex.wordpress.org/Class_Reference/WP_Query
Thanks!!