Goal: Create a page template that queries that database based on page title. This allows for "dynamic" pages based off of the title.
I've got the page template set up and working when I hard code the id, when I try and use the_title_attribute() it's not working. This is what I'm attempting.
$id = the_title_attribute(); $sql = "SELECT * FROM <databasename>.<tablename> WHERE name = '". $id."'"; $results = $wpdb->get_results($sql, OBJECT);
The issue with this is that the_title_attribtue() doesn't populate in time for my query because it's populating later for the page to be rendered. So I'm trying to figure out how to pull page title so I can use it in SQL select statements to generate content for my page.
Any help is appreciated.