Wordpress Custom Table or Custom Post Types?

前端 未结 2 1316
天命终不由人
天命终不由人 2021-01-02 20:21

I am using wordpress to make a site which has job posts, and I want to know the best way to go about storing company details, as each job post must be linked to a company.

2条回答
  •  醉酒成梦
    2021-01-02 21:10

    I suppose it is the best to use custom post types with post meta in conjuction with meta boxes. This way, you will be able to manage in ease your companies, and yet, you will be able to operate custom queries on companies via the WP_Query class.

    Currently I am building a business directory for a my client, so I decide to use the custom post types because of flexibility. Also I made a custom script for managing company information in conjuction with post meta.

    Take a look in the screen shot to undestraint what I mean :

    enter image description here

    Note that whenever I like to add new data to companies, I am free to just add some extra meta boxes, and then save the extra data as meta data for the post. This way is matter of minutes to extend a standart data entity.

    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 (optionaly) http://codex.wordpress.org/Function_Reference/get_post_meta http://codex.wordpress.org/Function_Reference/add_post_meta

    I hope you this will help you :)

提交回复
热议问题