0

Just I want to create the Project master, there I'll maintain the fields like 'Project type', 'Project Category' and 'Project name'. I've created the table in DB. I thought it is easy to achieve in Custom post type. So I followed the following steps

  1. Created the custom post type as 'Project'
  2. Created the Meta box and fields to get the user input for 'Project type', 'Project Category' and 'Project name'
  3. On save, via hook 'save_post', I got the user input through $_POST and saved the data in custom table( eg: wp_projects )
  4. The real problem occurred while listing the entries, I've used the 'custom_column' function, but it requires the post ID. But I haven't used post table to save the Projects.
  5. In 'custom_column' function I don't know how to iterate the Project table entries without using Post ID

One of my colleague suggest me to use 'wp_list_tables' class to list the entries in the custom table. I did the same, but here I'm not sure what will be the link to edit the custom table entries.

I'm struggling to create the master without using the Posts table. I don't want to insert the entries unnecessarily in post table, because that table is not suites to the Project table fields.

Thanks in advance.

8
  • What exactly is this master? Commented Mar 23, 2012 at 10:00
  • 1
    If you created a new table you'll have to write your own wrappers for it, don't expect anything else to work with your table. Extend WP_Query codex.wordpress.org/Class_Reference/WP_Query and the bunch.
    – soulseekah
    Commented Mar 23, 2012 at 10:02
  • 2
    Why don't just store everything in wp_posts and wp_postmeta tables?
    – Mamaduka
    Commented Mar 23, 2012 at 10:23
  • 2
    If you created a custom post type named "project" then each project has a post id
    – Bainternet
    Commented Mar 23, 2012 at 14:21
  • @RutwickGangurde Gangurde This master just to maintain the project details like 'Project type', 'Project Category' and 'Project name'. For this kind of information, I don't want to use the post table.
    – A.C.Balaji
    Commented Mar 23, 2012 at 16:37

1 Answer 1

1

This Question is kind of vogue but I'll try to answer best to my understanding (mostly from the comments)

You can either use the build in post types where the pros are : A built in Admin UI, Easy queries wrapper, and built in table listing, but the cons, as far as i can tell is the unnecessary fields in the posts table.

Or you can use your custom table which will store just the fields you need but the cons here are that you will have to write your wrappers to working with it including creating your tables listing from (almost) scratch and create your own admin UI to manage and use the project records.

Sure the easy way would be to use the custom post type but I do understand the major problem it presents if you don't have any use for most of the fields and you expect 100,000 of records (anything less shouldn't be a problem or cause performance issues, just a big table in the database).

So i guess its up to you which way is better to go with.

1
  • Thank you, finally I would like to go with Posts table itself. could you please direct me about how to write our own wrapper to deal with these kind of tasks. Otherwise instead of creating Wrapper(doing everything from scratch), please advice me, whether Wordpress is the right Tool to achieve this ?
    – A.C.Balaji
    Commented Mar 24, 2012 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.