I see this subject comes up regularly but have not seen an answer to my specific requirement yet.
I'm trying to use a WordPress page as a template and insert database-sourced content (about 20 or so fields of text, including image file names) based on an ID passed as a URL parameter (and index to my database). e.g. www.example.com/examplepage/?pid=123
Before WordPress, I could do this in PHP easily by executing some code to get a database record and then writing out HTML interspersed with those fields.
I have a plugin in WordPress that allows me to do some PHP code snippets on page, but that's in the page body and I believe the header has already been written out. The header has fields like title and meta desc that I'd like to be populated by dynamic content.
I've seen plug-ins for CMS-like management of real estate listings, movies, etc. but my database handling is a but unusual so I have to take a custom build approach.
I understand that I may need to do some work in the functions.php script for my theme in order to dig into WordPress' page rendering, but I'd like to be careful not to disturb general pages/posts on my site. It's just this one special page that will accept a parameters and load the appropriate content.
Some advice on the steps I need to take would be most appreciated.