Wordpress Custom Table or Custom Post Types?

前端 未结 2 1311
天命终不由人
天命终不由人 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 :)

    0 讨论(0)
  • 2021-01-02 21:13
    • Create an Custom post type
    • add the custom fields to that custom post type for different fields you need,

    There is no need of creating table manually,

    • http://wordpress.org/plugins/custom-post-type-ui/
    • http://wordpress.org/plugins/advanced-custom-fields/

    and you can apply the sorting on some custom field you added to the post type,

    0 讨论(0)
提交回复
热议问题