I need a WordPress plugin developed that does the following:
1. If a WordPress page/post does not exist, it checks with the plugin to see if it should be processed through the plugin. If yes, continue to plugin, if not, then standard 404 error processing.
2. The plugin will check for a match based on the final number combo (separated by a dash) in the URL. For example
http://mydomain.com/category/789/
http://mydomain.com/111-the-url-789/
http://mydomain.com/111-the-url-789.html
all of those should be treated as “789” as the key ID to check.
The plugin will then query an external mysql database (the connection string can be hard-coded for now) to see if there are any results. If there is a match then continue. There will either be 1 match or 0 matches. If there are multiple matches, only return the first result.
3. A successful match based on the previous step should return a name/value map of all of the field names with their values for that row. I don’t want to have to program in the field names, I want the plugin to determine what all the potential field names are and return those along with their values.
4. The plugin should then load a template that will be stored as a hard-coded file in the plugins directory. The template file will contain variable names based on the field names in the database. WordPress should then load this as the content and place it in the current default page template in the current theme.
Here is an example of it in use.
I will have an external database with values like this:
ID: 2468
First_Name: John
Last_Name: Doe
City: Raleigh
If someone goes to the URL http://mydomain.com/hello-world-2468.html
(and that page doesn’t exist as a current post or page in WordPress), then the plugin will take the ID (the last numeric portion after the last ‘dash’ in the URL) and query an external database (this is separate from the WP database …I will provide the MySQL username/password for this).
The plugin will query the table in the database (hard coded) and return all field names / values and will load those into a template.
My template will be placed in the plugin folder and will be something like:
<p>Hello. Are you looking for {First_Name} {Last_Name} in {City}?</p>
That content should then be displayed in the default Page template for the current theme.