By Tal Galili

2010-08-15 23:06:29 8 Comments

I wish to create something like with (So to have one website that is a "database", and another one, which is a blog, that connects to it).

Is it possible? and how?

Thanks, Tal


@edelwater 2010-11-14 00:24:40

However..... if you do think using another database is easier because you are e.g. syncing this daily with other sources, already have all the reporting code , use this database for a lot of other sources, prepare for the future when you might want to use this database in other projects to sync, are adding the data from another application, etc.... The trick is to switch databases:

// Connect to the other database
$mysql_link_edl = mysql_connect($db_host, $db_user, $db_pwd) or die (mysql_error() .        'Error connecting to mysql');
mysql_select_db($db_db, $mysql_link_edl) or die (mysql_error() . 'problem connecting with database');

then do your stuff, run all queries / external php files generating reports, etc.. and then switch back to the WP database:

mysql_select_db(WPDB_DATABASE, $mysql_link_edl);

@MikeSchinkel 2010-08-16 03:17:52

@Tal Gailili: Absolutely, WordPress would be a great platform for a CrunchBase clone!

Use Custom Post Type and Custom Taxonomies

What you want to look at are Custom Post Types and Custom Taxonomies [see this answer I gave on a very similar subject].

Example Code for your Company's Post Type and Taxonomies

With WordPress 3.0 you can create a company custom post type and then one or more custom taxonomies that apply to the company such as category, funding and status. To bootstrap your efforts here's code you can drop in to your theme's functions.php file to get your started:

        'label'           => __('Companies'),
        'public'          => true,
        'show_ui'         => true,
        'query_var'       => 'company',
        'rewrite'         => array('slug' => 'companies'),
        'hierarchical'    => true,
        'supports'        => array(

register_taxonomy('company-category', 'company', array(
    'hierarchical'    => true,
    'label'           => __('Categories'),
    'query_var'       => 'company-category',
    'rewrite'         => array('slug' => 'categories' ),

register_taxonomy('company-status', 'company', array(
    'hierarchical'    => true,
    'label'           => __('Status'),
    'query_var'       => 'company-status',
    'rewrite'         => array('slug' => 'status' ),

register_taxonomy('company-funding', 'company', array(
    'hierarchical'    => true,
    'label'           => __('Funding'),
    'query_var'       => 'company-funding',
    'rewrite'         => array('slug' => 'funding' ),

Other Post Types you might want:

If you really want to clone CrunchBase you'd be wanting to create custom post types for each of these (though I'm guess you want something similar but for a different market?):

  • People
  • Financial Organizations
  • Service Providers
  • Funding Rounds
  • Acquisitions

Company Listing Page

For your company's listing page (like this one on CrunchBase) I'd probably create a WordPress "Page" called "Companies" (imagine that!) and then use a post list shortcode plugin like List Pages Shortcode (if you use that one you will need to make a one-line modification to support Custom Post Types like I show here.)

With that plugin and modification you can add the following text to your "Companies" Page and it will list out all the companies in a bulleted list on that page which you can style with CSS:

[list-pages post_type="company"]

Company Specific Layouts

Then for a custom layout for each company you can make a copy of the theme template file single.php and name it single-company.php and make whatever modifications you want to the layout there.

User Company Submissions

And if you want to let people submit companies consider using Gravity Forms (not an affiliate link; US$39 per site license and worth every penny.)

If you need more...

There's more I'm sure but that will get you most of the basic functionality you need. If you need more, ask another question here on WordPress Answers!

Hope this helped.

@Tal Galili 2010-08-16 03:42:07

Wow - what an amazing answer!

@Callan 2010-08-16 13:24:38

Flawless victory. This should be used as an example of how answers should be done here.

@Osu 2012-08-01 09:37:52

Hi @MikeSchinkel - I'm interested in using Gravity Forms, but does it let users submit companies directly into Wordpress's database for approval by an admin, or would it be the same as just building a form that sends the data to an email address? I'm looking into ways to streamline the process for admins to add companies. Thanks for your time, Osu

@Callan 2010-08-16 00:59:18

There's no reason it can't be done, using custom post types and the appropriate templating to make it suit... but whether it's the RIGHT way to do it is a different matter. is down at the moment so I can't do a proper valuation, but from what I remember of it, it'd be better suited to being a WordPress blog + custom plugin to handle the database entries, sort've like how an e-Commerce plugin works for WP. Keep the database of company information stored and managed via a plugin, that also lets you embed relevant info into blog posts using a function from the plugin.

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Automatic Wordpress Clone Backup

1 Answered Questions

how to create database to use it in wordpress website?

  • 2016-11-20 12:20:58
  • Alaa
  • 46 View
  • 0 Score
  • 1 Answer
  • Tags:   plugins database

2 Answered Questions

[SOLVED] Searching Only Blog Posts From a WordPress Site's Main Posts Page?

  • 2010-09-10 13:43:13
  • cannyboy
  • 1838 View
  • 1 Score
  • 2 Answer
  • Tags:   cms search

2 Answered Questions

[SOLVED] Import External XML

1 Answered Questions

[SOLVED] Migrating database / content of non-CMS site to Wordpress

1 Answered Questions

[SOLVED] Wordpress Book Exchange Plugin Equivalent?

  • 2012-03-18 22:53:03
  • Oliver Spryn
  • 826 View
  • 0 Score
  • 1 Answer
  • Tags:   plugins cms

5 Answered Questions

[SOLVED] Building a Digg clone using WordPress?

1 Answered Questions

Sponsored Content