Code

How can I export hotspots using WP All Export a...

« See all FAQs for WordPress Tooltips Ultimate & Image Hotspot

How can I export hotspots using WP All Export and import them in another site using WP All Import?

Steps to export the hotspots

1. Install and activate WP All Export.
2. Go to All Export > New Export.
3. In Specific Post Type, select Image Hotspot.
4. Click Customize Export File.
5. Click Add All to enter all available fields.
6. Click the

wpcmtt_hotspot_points_meta_hotspot_tooltip 

field and use the PHP function below:

function hotspots_export($value) {
    $value_unserialized = unserialize($value);
    $value_json = json_encode($value_unserialized, JSON_HEX_QUOT | JSON_HEX_TAG);
    return $value_json;
}

Please see the relevant image below

4. Download your CSV.

Steps to import the hotspots to the new site

1. Install and activate WP All Import.
2. Create a new tooltip style. Make sure that you copy the tooltip style ID. You will need it later.
3. In the Images section of your import, make sure that you add the

{wpcmtt_hotspots_meta_basic_image[1]}

Please see the relevant screenshot below

4. Make sure that you add the custom field

wpcmtt_hotspot_points_meta_hotspot_tooltip

and pass it through this function

[hotspots_import({wpcmtt_hotspot_points_meta_hotspot_tooltip[1]})]

5. Also make sure that you add the custom field

wpcmtt_hotspots_meta_basic_image

and pass it through this function

[hotspot_basic_image_import({wpcmtt_hotspots_meta_basic_image[1]})]

6. Also add these PHP functions:

function hotspots_import( $value ){
    $value = json_decode($value, true);
    foreach ($value as $key => $field) {

        // Mapping: 
        $old_wpcmtt_hotspot_points_meta_style = $value[$key]['wpcmtt_hotspot_points_meta_style'];
        $new_wpcmtt_hotspot_points_meta_style = "0"; // Insert your new style ID here
        // Use the if statements below if you want to map old styles to new ones
        if ($old_wpcmtt_hotspot_points_meta_style == "12") {
            $new_wpcmtt_hotspot_points_meta_style = "111";
        } elseif ($old_wpcmtt_hotspot_points_meta_style == "34") {
            $new_wpcmtt_hotspot_points_meta_style = "222";
        } elseif ($old_wpcmtt_hotspot_points_meta_style == "56") {
            $new_wpcmtt_hotspot_points_meta_style = "333";
        }

        $value[$key]['wpcmtt_hotspot_points_meta_style'] = $new_wpcmtt_hotspot_points_meta_style;

        // Compatibility fix for hotspots created with version < 3.0
        if(!isset($value[$key]['wpcmtt_hotspot_points_meta_hotspot_link'] )){
            $value[$key]['wpcmtt_hotspot_points_meta_hotspot_link'] = "";
        }
    }
    return serialize( $value );
}

function hotspot_basic_image_import( $value ){    
    $pieces = explode("/", $value);
    $upload_dir = wp_upload_dir();
    return $upload_dir["url"] ."/" . end($pieces);
}

For steps 4,5 & 6, please see the relevant image below

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey