I am trying to customise a WordPress theme. I have a function in themes/functions.php that I would like to run on some pages.
I need to be to:
- Detect the page ID to determine whether the function should execute
- Determine which hook to attach the function to (preferably something like page load.
Cheers
The file
functions.phpis for theme specific functions called inside your theme. If this is a theme specific function then the function call should be in the header (or wherever you want the output of the function to appear) via<?php my_function() ?>.Hooks are for plugins, not template specific code.