WP database issue

jlknauff

New member
Aug 25, 2008
237
1
0
I'm working on a plugin that takes input from a form, then populates a table in a Wordpress database and then creates a page in WP to display that data.

I've got everything working except I can't find out where WP stores the info for page templates.

In this case, the page created in WP needs to use a particular page template but I can't find any mention of it anywhere in the DB. If I got to the page that's been created in the admin area, I can manually set the page template.

Can someone point me in the right direction?
 


I'm working on a plugin that takes input from a form, then populates a table in a Wordpress database and then creates a page in WP to display that data.

I've got everything working except I can't find out where WP stores the info for page templates.

In this case, the page created in WP needs to use a particular page template but I can't find any mention of it anywhere in the DB. If I got to the page that's been created in the admin area, I can manually set the page template.

Can someone point me in the right direction?

Aren't page templates simply files that wordpress finds in the themes root folder with the tag:

Code:
<?php
/*
Template Name: [insert your template name here]
*/?>

at the top?
 
Yes, but you missed the point. Somewhere in the DB, it stores the info about which pages use which templates. That's what I'm looking for.
 
this is the query:

Code:
SELECT * 
FROM  `wp_options` 
WHERE  `option_name` LIKE  '%theme%'

but wordpress usually uses only one theme, so there's no way to set theme/post or theme/page, unless you have that functionality built in or via a plugin
 
Yes, but you missed the point. Somewhere in the DB, it stores the info about which pages use which templates. That's what I'm looking for.

Search the wp_postmeta table for your page / post id. The meta_key is "_wp_page_template." Sorry I misunderstood you earlier.