Let's say I created a very simple template for my custom theme:
When I assign this template to a Page, I'd like to hook a plugin into a spot where I can parse this template and replace position1 and position2 with the contents of other Pages, or media, or anything else.
What hook can I use to get in there and make that change? I don't imagine I can use any filter hook since the template is a file, not some data from the database. I initially tried using the action hook "wp", which seemed promising, but it's executed for admin pages and I don't see a non-hackish way to tell from my plugin whether the current page is an admin page or not
That said, it seems like the "wp" hook could work, but is there a different one I should be using?