Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

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.

share|improve this question

3 Answers 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.

share|improve this answer

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.

share|improve this answer

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.
share|improve this answer
    
Hi Rarst, I am not sure if I understand correctly. What you are saying is: 1. store the identifier of each property (from my system) in the posts table. 2. Have a function that will replace the content of the post with content from my system by using the post id which is the same as the property id in my system. 3. When a property is added to my system, its id has to be added to the posts table. So I guess this means that I have to have a record in the posts table for each property for this to work. Is there now way around that. I want to avoid have to populate the posts table. Thanks. –  VinkoCM Jan 14 '11 at 15:14
    
Here is another idea, but I am not sure it would work: 1. Create a plugin that hooks into or filters for a particular page. 2. By default, the plugin shows a search form and a list of results if the form is submitted. 3. To see a particualr property, a variable (ex: prop=34) is appended to the URL. If the variable is present, the plugin displays the property information. Would this work? I guess this way I would not have to populate any posts. But how do I hook into/filter for a whole page? Would I be able to modify the page title and description? –  VinkoCM Jan 14 '11 at 15:53
    
@VinkoCM well, if you don't want to store any data in WordPress I don't really understand what you want from WordPress in such case. :) Personally I don't think populating posts is such a big issue (well, unless you have absolutely crazy amount of those properties) and you definitely need that to take advantage of such WordPress features as taxonomies, etc. –  Rarst Jan 14 '11 at 15:57
    
What I am looking to do is provide my clients another way of showing their properties/listings on the wordpress platform. I like wordpress because it is easy to use and setup and I can teach my clients how to manage their own site. The reason I want to keep it separate is so that there is only 1 source from where to extract data. Also, I won't have to worry about synchronizing the data between the 2 systems. –  VinkoCM Jan 14 '11 at 16:05
    
@VinkoCM my point is that if you don't have data in a form that WordPress can understand and manage then you loose a lot of WordPress functionality. It's not a WordPress expansion, it's more like small and weird WordPress patch on something else. –  Rarst Jan 14 '11 at 16:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.