I'm wanting (for complicated reasons) to dynamically change an individual Post/Page title (for front-end browser display purposes only, not in DB).
However, for reasons, I need to do this on the fly within the actual post's content using PHP-Exec plugin (allowing me to do PHP in the post) and possibly, WP hooks/actions etc.
I have 1 WP page, that using htaccess and Exec-PHP will act as a template for many different article pages, and thus when that page is called (from one of the many different URLs that will call it), the page will access the DB, and retrieve an article title, and article body based on the calling URL.
The resulting outputted page will have that article body in it - achievable as Exec-PHP is being using in the Post body to do all this.
However I also need to also change the Post title (that appears in the browser top, and in the templates <h1> tags etc) to reflect the article title from the DB. This is the problem, I can't work out how to change the page title using exec-php in the page content.
Is there anyway I could alter these titles on the run, using WP hooks/actions or whatever?
Is this even possible? If so, how?
Hoping this makes sense.