CMS & WordPress
I've worked with a little php, but am by no means an expert. I've created a custom post type in which I'm going to use to store a list of names and emails. These aren't users, on a larger scale it's going to be used to extract who to send a dynamic email to.
In any case, I've gotten far enough that I have the custom post set up in admin, but I'm not sure how to save it into or pull from a separate table. I'm using meta_boxes as well to create custom fields for the entries. I would prefer to send all of this info to my custom table without it interacting with wp_posts or the wp_meta_posts tables. I know that this can be done with old fashioned MySQL commands, but I think it would be best take advantage of the already built in behaviors that posts have. I've come across many things on the web that recommend to just keep with those tables, but the tables (at least the wp_posts table) is already overrun with information from regular posts. Is there a feasible way to do this? Do I use the wpdb command to do so?
Use WP_Query and the post_type attribute. The post_type will be whatever string you used when you registered your custom post type.
I think I see how this relates to custom post types, but I'm not really sure how it would with a custom table? I've not been able to find any example online that looks like what I want to do. I wanted to use the custom post method as it seems to do a lot on the admin side, but I'm not really sure as to how to specify those "posts" to go to a separate table
Are you saying you added custom posts to your own table, or that you want to?
Wordpress has built-in mechanisms in place so that you shouldn't need to touch the database directly, or manually add custom posts to a separate database table. The proper way to do this would be to register your custom post type, set up your custom fields, and query the post type to get the data back out.
If you are storing user information for an email list, try finding a plugin that will do this, instead of writing something from scratch. Maybe something like this: http://wordpress.org/extend/plugins/mail-list/
Or, you don't even have to do this in wordpress. Maybe something like http://www.phplist.com/ or http://dadamailproject.com/
I'm not opposed to using a plugin, but haven't really found one that fits within my needs.
I want the list info to go to a different table as the posts table is a mess from how they have the site set up.:
Here's what I'm looking for in the long run whether I have to write it, or incorporate a couple of plugins to do it:
The site is a franchise site, with several individual store pages within the same site. I want to create a Contact form that sends dynamically to each store owner according to which store it is.
I'd also like to create the admin section, that I'm working on now so emails and contact names are editable within the admin.
The plugin you mentioned seems to be more specific to customers instead of people with back end privileges. That's why I have my doubts that it would fit in with my needs.
This topic is now closed. New replies are no longer allowed.