HomePage Forums Traveler Import Locations as Hierarchy

This topic contains 4 replies, has 2 voices, and was last updated by  Bryan 3 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10955

    Hi Bryan,

    I have a list of Locations in a csv file and I can’t figure out how to use AllImport to bring them into the Traveler theme as a hierarchy.

    I tried using the “taxonomies, categories, tags” feature to try to get it to work. (I’ve added a screenshot of what I did.) But all that does is add attributes in a hierarchy to each Location.

    Instead, I need the locations themselves to be in a hierarchy (Country > Region > State/Province > Metro Area > City > Specific Location) so that a user can search for tours within a country / region / state / metro area / city / or specific location using a Location List in the search bar. Kind of like how New York is within the US in the demo.

    How do I set this up on AllImport? I have a lot of locations that will be changing so I can’t do this manually. (I’ve given you my admin access in case that’s helpful.)

    Thank you!

    Attachments:
    You must be logged in to view attached files.
    #10957
    This reply has been marked as private.
    #11004

    Hello

    To make the location display as Parent and Child, you have to export Parent type and import it to new site.

    My images will show you more details.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #11087

    I had trouble getting it to work with a csv file. Now I realize All Import doesn’t seem to be able to accommodate csv files with the set parent feature.

    However, I added the following code to functions.php and used a custom field (_tmp_parent_value) as a workaround.

    add_action(‘pmxi_saved_post’, ‘set_parent_page’, 10, 1);

    function set_parent_page($pid){
    $page = get_post($pid);
    if ( ! empty($page) ){
    $parent_page = get_post_meta($pid, ‘_tmp_parent_value’, true);
    if ( ! is_numeric($parent_page) ){
    $parent = get_page_by_title($parent_page);
    if (! empty($parent)){
    $parent_page = $parent->ID;
    }
    }
    if ( is_numeric($parent_page) ){
    wp_update_post(array(
    ‘ID’ => $page->ID,
    ‘post_parent’ => $parent_page
    ));
    }
    delete_post_meta($pid, ‘_tmp_parent_value’);
    }
    }

    More details here: https://kriesi.at/support/topic/please-help-modify-code-so-i-can-automatically-mapped-data-using-wp-all-import/

    #11122

    That is great to hear.

    Please contact if you have any other question so i can help you check it.

    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Traveler’ is closed to new topics and replies.