tags:

views:

2158

answers:

5

I want to implement a business directory in WordPress and I am looking for feedback on the best approach:

  1. I have a categories and a businesses table
  2. Do I create a page for every business together with it's category relationship
  3. Do I create a page and assign it a template?
  4. What are the ups and downs with each approach?

Looking for some answers from people that might of already done this and can speak from experience

+2  A: 

The nice thing about WordPress is that you can go a few different routes w/ trying to accomplish this.

One route that's worked well for me is to list each business as a post and then create categories and sub-categories to house these businesses. Once this is done, you can create custom templates for either category templates (so if your have a category named 'Food Establishments' and it has the category id of 5, you can create a template named category-5.php and then WordPress will know to look to that template first and then move on to the regular category.php file and so on).

In your category template you can then list out each sub category w/ a function like wp_list_categories(); and call out the children categories from there.

The other option is to still go the route of entering in your businesses as a separate post, filing them under the appropriate categories. But instead of creating a category template, you can create a page template. You'll need to do a few things for this

  1. Pre-prend your template file w/ the necessary template syntax to tell WordPress to look for that as a template file such as:

    < ?php /* Template Name: Food Establishments */ ?>

  2. Create a page in WordPress using this new template

  3. In your page template create a new query, pointing to this category, such as:

    < ?php $business_food = new WP_Query('cat=5'); ?>
    < ?php if ($business_food->have_posts()) : while ($business_food->have_posts()) : $business_food->the_post(); ?>
    < ?php the_content(); // and do other stuff here ?>
    < ?php endwhile; endif; ?>

There are other options you can do as well, and for those, I would hang out some WordPress user groups to see if you can grab some other ideas.

Tim Schoffelman
thank you very much - i had almost given up there and was going to leave the Praized community plugin in place. Any groups specifically you recommend? I am already watching the wordpress groups.
NTulip
Tim Schoffelman
A: 

You could take a look at: Business Directory For Wordpress.

I have used that as the basis for the directory on Caversham.info.

Andy
+1  A: 

Checkout www.juicyexeter.co.uk this apparently uses wordpress, maybe take some cues from this.

Steve J
that is quite nice. Seems to be all categories and pages. are you involved in that website at all?
NTulip
A: 

I think juicyexeter uses a WooTheme: http://www.woothemes.com/2010/03/cityguide/

Christian Skelton
A: 

please does anyone know any business directory theme. like a yellow page.

Static Caravan Sites