I wish to create something like CrunchBase.com with WordPress.org (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
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI wish to create something like CrunchBase.com with WordPress.org (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
@Tal Gailili: Absolutely, WordPress would be a great platform for a CrunchBase clone!
What you want to look at are Custom Post Types and Custom Taxonomies [see this answer I gave on a very similar subject].
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:
register_post_type('company',
array(
'label' => __('Companies'),
'public' => true,
'show_ui' => true,
'query_var' => 'company',
'rewrite' => array('slug' => 'companies'),
'hierarchical' => true,
'supports' => array(
'title',
'page-attributes',
'excerpts',
'thumbnail',
'custom-fields',
'editor',
),
)
);
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' ),
)
);
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?):
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"]
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.
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.)
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.
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.
CrunchBase.com 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.
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);