Site icon Hip-Hop Website Design and Development

load/require particular php recordsdata for particular pages/templates/put up sorts

I’ve a plugin with a number of php recordsdata. I need to load a few of them solely when particular template recordsdata are loaded. I do not need to load the whole lot.

At the moment, I am doing it with
add_action( ‘wp’, ‘load_files’ )
, nevertheless it means actions outlined within the further php recordsdata are usually not being performed.
Any concepts?

EDIT: Looks as if there’s a few of work round, by getting the id from the url, like this
What's the earliest level I can get the queried object ID?

I nonetheless do not know if there’s any choice to work from the WP capabilities, as this manner shouldn’t be my most well-liked method