Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

sym_slip on "Creating Custom WPDB Tables?"

$
0
0

Hope this is in the right forum...I'm in the middle of creating a WordPress Plugin more or less for the first time, and have hit a bit of a wall. I've read through quite a bit of the Codex, but I'm still thoroughly lost on my next steps - and many of the Codex's examples don't seem to work.

The plugin I'm creating is intended to let users select backgrounds for single post pages based on the tags associated with that post. So a post tagged "horses" can be set up to have a background image of horses, and so forth. I've got the settings page set up to create a drop down menu via get_tags already, but haven't gotten beyond that yet.

My basic thought process/plan was to have the plugin's user be able to pick from the different tags on the settings page (via drop down menu) and allow the user to type in the url for the background image. They can then save that tag + background image url to the WP Database.

Then, at the head of each post (via wp_head?), check to see what tags the post is tagged with, and check to see if any of the tags match those in the database that have images associated with them. If yes, use CSS to change the page's background; if no, default to the background in use by the theme. (Aka, do nothing)

Where I'm stuck is:

1) I'm not sure how to create tables/store this data in the WordPress Database;
and 2) I'm not sure how to properly handle the code for the header.

I do know enough PHP to do this "raw" (so to speak), and know how to prevent script injection, but I'm very new to WordPress and so I'm getting bogged down trying to figure out how WordPress handles these things.

Any help/advice you guys can offer would be greatly appreciated! I can provide my existing code if it'll assist, though at the moment it's turned out fairly barebones. :)


Viewing all articles
Browse latest Browse all 8245

Trending Articles