I’d like to change titles of some pages without changing metadata stored in a database but rather to create and display a page title dynamically (based on e.g. embedded custom post id, etc.). What would be the optimal way to do it in GP?
WordPress uses the_title() function to output the title. That function has the_title filter, however WordPress uses the same filter for things like widget titles and menu item titles, so it’s nearly impossible to target the content title, unfortunately.
Your best bet would be to disable the standard title and add your own title function into the page using Elements. That way you could conditionally load the title based on your own parameters.