Output custom content not from the posts table?

It would be best if I started out be explaining the situation:

A while ago I created a Property/Real Estate management system using PHP and MySQL. It works great and I have a lot of customers using it now but I would like to expand its capabilities to wordpress. I know a little bit about plugin development, but I do not know how to approach the project or how to design it.

Read More

Basically I want to create a plugin that takes information from a database (the one with all the property information) and displays it in wordpress. I need to create 3 parts: a search form, a results list and a page to display the property information. Here are some important points:

  1. I do not want to add the property information to the posts table. For example, on posts/custom-post-type per property. I want to retrieve the data directly from another table.
  2. I want to be able to use friendly URLs. For example: http://mysite.com/property/56
  3. I want to be able to set the title and description (in the head section) with data from each property
  4. All of this has to happen from the plugin and CANNOT rely on the theme.

So, what are your ideas? How should I approach this challange? Here is what I have been thinking, but I am not sure if it will work:
1. Create a custom post type called ‘Property’.
2. Create a template file for displaying the property information.
3. Create a template file to show the search form and results. This could be like and archive template
4. That is as far as I got. I don’t know how to make wordpress display a post that actually is not there.

Anyways, what are your ideas?

I appreciate the help.

Related posts

Leave a Reply

3 comments

  1. Basically you want custom posts in WordPress that will be just pointers to external data?

    If you don’t want full import then:

    1. Store some kind of unique property identifier (that makes sense for your external data) as meta field or guid in custom post type.
    2. Make wrapper function that will take ID of your custom post, retrieve identifier from it and use separate instance of wpdb class to query and return data from external database (assuming it’s also MySQL or you are on your own with retrieving that data). Use this in template as needed or append to post content with filters, etc.
    3. Add some dressing, like periodic import of property identifiers with cron.
  2. I have been through this, it is highly dependent on how your getting the source real estate data, direct database access, rets , mls, ibx, flat exports, rss, etc?

    If your source is highly competent they could easily provide a json or rss feed ( or an API even better), this is by far the best option.

    If they are using more traditional flat file exports or database exports, then you will need a custom script that parses the data to be inserted into the WordPress database properly. I would recommend what Rarst said and in fact this is how I did it.

    Using custom post types and custom meta fields, all the data is thrown into the meta fields which made it very easy to output using all built in WordPress functionality ( archives, tags, category’s, permalinks, query’s, etc).

    The only caveat was customizing the search for meta fields, due to the difficulty and time I used a plugin and it works perfectly fine.

    ps. The alternative, which I did test out, was Pods CMS ( plugin), but in the end I just used the default tables.

  3. Store your data in your own tables…. slap a [shortcode] in a wordpresss page that calls a function which queries your custom data. No need for pointers and all that.

    In the backend build an admin interface to import from external sources and manage the data.