Support » Fixing WordPress » Creating a dealers plugin

  • Hi all, I was given a task to create the following “custom” plugin in WordPress, and after a lot of research some things still don’t make sense to me.

    The following features are needed:
    – Admin users need to be able to create “dealers” that would have custom properties such as name, description, picture, contact info, type, cost
    – Users need to be able to search for these dealers by type and cost(range)
    – Admins would create logins for each dealer
    – Each of the dealers should be able to log in and edit their own dealer info/properties.

    What is the best way to develop this plugin? Would using Custom Post types be the most straight forward, or writing something more specialized with new database tables is the only way here? I’d like to use as much of the WordPress functionality as possible without reinventing the wheel, and I can’t seem to find any plugins that do something similar(Most likely I don’t know what to search for). I have found some example for custom dealer login, but I would do that feature last, once I have the rest setup properly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Dima,
    I’m not a pro coder, but this is how i use to work when i create my plugins in WP:
    – Dealers can be found using search engine ? > Custom post
    – Huge amount of dealers / data > Database
    – Few dealers / data > WP options

    In your case, ill do it with options probably. All depends on the amout of dealers you will create.



    I would suggest you to create a Custom Post Type by hand with custom metaboxes enabled for the additional properties you want to be stored against a dealer. Information from custom metaboxes get saved in wp_postmeta table against Post ID, which is actually your Dealer ID.

    Login information should be saved in wp_users and wp_usermeta table. For searching you need to tell your custom query to use your custom post type. To make your custom post type to appear in search result you need to make ‘public’ and ‘publicly_queryable’ properties to true when you register your custom post type.

    function namespace_register_dealer_post_type() {
        $args = array(
            'public' => true,
            'publicly_queryable' => true,
            'label' => 'Products'
        register_post_type( 'product', $args );
    add_action( 'init', 'namespace_register_dealer_post_type' );

    Here is a tutorial about how to create a custom post type:

    For metabox following two articles should help you:

    The following snippet will give you the idea about searching custom post type using meta values:

    function namespace_search_dealer( $query ) {
        if ( is_search() && $query->is_main_query() && $query->get( 's' ) ) {
                'post_type', array('post', 'page', 'dealer'),
                'meta_query', array(
                    'key' => 'wysiwyg',
                    'value' => '%s',
                    'compare' => 'LIKE',
            return $query;
    add_action( 'pre_get_posts', 'namespace_search_dealer' );

    Let me know if this helps you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating a dealers plugin’ is closed to new replies.