Literally just got done doing this and spent HOURS and HOURS on it. Hopefully I can give you some pointers…though I’m still jammin’ on the site build so won’t have much of any followup.
Unfortunately I was unable to find any free plugins that allow a WP exported xml file to be imported in to a custom post type like WP Listings delivers. There is also a lack of free CSV importing plugins to do the same thing…all the csv importers have commercial versions to buy if you need to import in to a custom post type.
**IMPORTANT**
Make certain you backup the database right before trying an import. We made a backup which we used at least 25 times until we got the import perfect. If we goofed one up we’d delete all database tables in phpmyadmin and upload that database backup. Try again, goofed up again, delete again and upload again.
So anyhow, here is my adventure in a nutshell:
Project: Moving a client site, which displays over 1,000 properties which were posts, and import them in to WP Listings using a new, mobile responsive theme (Studiopress’ AgentPress).
Steps:
1) Cloned the site and database for the new site in to a subdirectory. The property posts (which were just posts) used postmeta in the old theme to store all the stuff WP Listings stores in its postmeta, so now it didn’t display in the new theme. We needed to get those posts in WP Listings so they’d have all data displayed as well as looking great.
2) I first off did buy the commercial plugin called “WP All Import Pro” and they were really great and responsive…but importing custom fields from the WordPress XML export was REALLY tricky. Since it was tough to programmatically bring in postmeta consistently — the numeric keys change post-by-post — so the data didn’t come in consistently and go in to the correct fields. They did help out with support tickets and we tried and tried their suggestions in a bunch of different ways, but I decided we needed “cleaner” data first and then we could use WP All Import to bring in the csv data.
3) Using phpmyadmin, I exported ONLY the property posts. Tried a buhc of different SQL queries I found via Google, but ended up getting a lot of tips and ideas from the video here.
4) That resulted in the data I could use and put into a spreadsheet which I could then save as a .csv. Here is an Excel template I made of the fields you need.
(Note that I put some data in so you can see that I added my own WP Listings taxonomy types, including one called ‘Market Rate Rentals’, and used “Listing Price” and other fields for stuff like phone number and website. You can even add text or HTML as post content if you don’t have any for some posts).
5) Copied the “single-listing.php” template from WP Listings in to my theme’s folder and modified it so some custom field names in WP listings display different data like the Website, Phone and Email (see #6 below). Here is my modified version so you can see the changes I made to the original.
6) Modified the *display* of the field names in WP Listing’s “Details” tab by adding this code to my theme’s functions.php file:
# Add filter for listing details
add_filter( 'wp_listings_property_details', 'custom_wp_listings_details');
function custom_wp_listings_details() {
$property_details_columns = array(
'col1' => array(
__( 'Address:', 'wp_listings' ) => '_listing_address',
__( 'City:', 'wp_listings' ) => '_listing_city',
__( 'State:', 'wp_listings' ) => '_listing_state',
__( 'ZIP:', 'wp_listings' ) => '_listing_zip',
__( 'Phone:', 'wp_listings' ) => '_listing_mls',
),
'col2' => array(
__( 'Website:', 'wp_listings' ) => '_listing_year_built',
__( 'Email:', 'wp_listings' ) => '_listing_floors',
),
) ;
return $property_details_columns;
}
7) Now that all the data was ‘clean’ in the spreadsheet, I exported it as a .csv and then I imported it using WP All Import Pro. It worked!! Everything went in to the correct fields. Phew.
Hope this helps.