I’ve been working on a project that requires me to reference an external database of property listings – 106,000 of them – and display these listings in WordPress.
One way I thought of was to create a plugin to read the listing data into WordPress, create a post and custom meta fields (or even a custom post type) with all that listing information and then categorize / tag each post allowing themes to organize the listings as needed. I reviewed that idea didn’t think it was necessary to duplicate the real estate listing data in the WordPress database.
I thought it would work so I reviewed the wp_insert_post function in the Codex and found it had a parameter “import_id”. Now, if I could make that import_id match the real estate listing id I could easily use the categorization and tagging capabilities of WordPress to organize the posts. When populating the WordPress site I query for and retrieve the listing ids from the database, get the id and create the post. Then, just after the post creation process I further query the listings database and create the categories and tags I need assigning them to each post id.
With all the listings referenced in WordPress I can search on and display posts by category and tag or include some external searching capability to get the IDs I want and then use WordPress to display the listings that matched the search.
For the purposes of the project this method worked, but with one side effect. All the menus, pages and other WordPress elements are numbered like the posts. So, at some point, there may be a clash between a numbered menu item and a real estate listing with the same id but I’ve yet to hit it.