Custom Wordpress spreadsheet or custom post types?

I use wordpress to create a website that has vacancies, and I want to know how best to store information about the company, since each workplace should be associated with the company.

Normally, I would simply set up the company table in my database and put the company identifier at each workplace, then join to get company information.

However, I often came across the thought that it is not always the best option in developing Wordpress to create new tables (for example, here ). Instead, I'd rather use custom post types.

But how will it work to store company data? Would it be right to create your own type of message for companies, and then add a new position for each company? And then use custom fields to store data about each?

Or am I better off creating new database tables? Which is better and why?

+5
source share
2 answers

I believe that it is better to use custom post types with post meta in combination with meta-boxes. Thus, you can easily manage your companies, and nevertheless, you can manage user queries in enterprises through the WP_Query class.

I am currently creating a business directory for my client, so I decided to use custom message types because of the flexibility. In addition, I created a custom script to manage company information in combination with a meta message.

Take a look at the screenshot to see what I mean:

enter image description here

Please note that whenever I like to add new data to the company, I can simply add additional meta fields and then save the additional data as metadata for the message. Thus, it is a matter of minutes to expand a standard data object.

What you need:

http://codex.wordpress.org/Post_Types http://codex.wordpress.org/Function_Reference/add_meta_box http://codex.wordpress.org/Function_Reference/register_taxonomy (optional) http://codex.wordpress.org/ Function_Reference / get_post_meta http://codex.wordpress.org/Function_Reference/add_post_meta

I hope you can help this :)

+6
source
  • Create custom post type
  • add custom fields to this custom message type for the different fields you need,

No need to create a table manually

and you can apply sorting in some custom field that you added to the message type,

+1
source

Source: https://habr.com/ru/post/1015064/


All Articles