Title: XML feed mapping
Last modified: June 23, 2019

---

# XML feed mapping

 *  Resolved [brandsforless](https://wordpress.org/support/users/brandsforless/)
 * (@brandsforless)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/xml-feed-mapping/)
 * Hello,
    your plugin is awesome. Many months ago i asked about a php function 
   to translate my product xml feed from English in my languange -Greeks. You sens
   me the bellow function which work like a charm. function my_translate_data( $
   data ) { $map = array( ‘Translate this’ => ‘To this’, ‘Add as many mapping rules’
   => ‘As needed’, ‘In this’ => ‘Array’ ); return ( array_key_exists( $data, $map))?
   $map[ $data ] : $data; }
 * The problem is that the use of the function is also modify and the permalink 
   in my languange. With other words i need to translate in Greeks the product title
   but leave the permalink slug in English.
 * Is this possible and if yes does it need to add an extra code in the php function?
 * Thank you in advance.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fxml-feed-mapping%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11676057)
 * Hi [@brandsforless](https://wordpress.org/support/users/brandsforless/)
 * > With other words i need to translate in Greeks the product title but leave 
   > the permalink slug in English.
 * In that case you could put the English slug in the _Other Post Options -> Post
   Slug_ field inside the import template: [https://d.pr/i/1JxyqH](https://d.pr/i/1JxyqH).
   I’m assuming this would be your product title element without the function.
 *  Thread Starter [brandsforless](https://wordpress.org/support/users/brandsforless/)
 * (@brandsforless)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11676201)
 * Thank you for your quick response.
    I do many trials with the field Post Slug
   with no effort. My item product in the xml feed is like this:
 * <product id=”107541″>
    <name>Skirt model 107541 IVON</name> <brand>IVON</brand
   > <category_path>/WOMEN/Women`s Clothing/Skirts</category_path> <category id=”
   125″>Skirts</category> <color>black</color> <type>Skirt</type> <images></images
   > <price>23.9</price> <description></description> <options> <option id=”M668398″
   > <option_name>36</option_name> <STOCK>5</STOCK> <avaible_in>7</avaible_in> </
   option> <option id=”M668399″></option> <option id=”M668400″></option> <option
   id=”M668401″></option> <option id=”M668402″></option> </options> </product>
 * What input i have to use in Post Slug for the <name> field during the import 
   process to be translated in Greece but the permalink keep in English?
 * Thank you
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11697955)
 * Hi [@brandsforless](https://wordpress.org/support/users/brandsforless/)
 * > What input i have to use in Post Slug for the <name> field during the import
   > process to be translated in Greece but the permalink keep in English?
 * In the Title put:
 * `[my_translate_data({name[1]})]`
 * See: [https://d.pr/i/vR9NYg](https://d.pr/i/vR9NYg).
 * Then, in the Post Slug, put:
 * `{name[1]}`
 * See: [https://d.pr/i/InO77g](https://d.pr/i/InO77g).
 * If you need further assistance with this please open a ticket at [http://www.wpallimport.com/support/](http://www.wpallimport.com/support/)
   so we can see your import settings & data.
 *  Thread Starter [brandsforless](https://wordpress.org/support/users/brandsforless/)
 * (@brandsforless)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11706741)
 * Hello,
    everything works like charms now. My function.php is ok. One more question
   please. Can i use seperate functions file for each import? My only one function.
   php is the same for all my imports. But in some imports i have to translate one
   word different way for each one. For example shirt translation is right for women
   tops but is not right for swimsuits and for tankini shist product. It will be
   very usefull to use different function.php for each import. Thanks
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11727052)
 * Hi [@brandsforless](https://wordpress.org/support/users/brandsforless/)
 * You can’t have multiple function files for our Function Editor, but you can create
   different functions for each import in the same file. Or, if you’d rather organize
   your code better, you could not use our Function Editor at all and move your 
   code to a plugin like Code Snippets: [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/).
 *  Thread Starter [brandsforless](https://wordpress.org/support/users/brandsforless/)
 * (@brandsforless)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11729003)
 * Thank you again for your response.
    Actually i do not like the idea to use another
   plugin. I prefer to have one function.php file from your Function Editor. As 
   you realize i am not a developer and run my e-commerce site alone. For sure i
   need to add a code for make the different function for each import. I think it
   need to add an add_filter command or something like this. Can you please suggest
   something to me for the following function? <?php function my_translate_data(
   $data ) { $map = array( ‘Lenght’ => ‘Μήκος’, ‘Total’ => ”, ‘Size’ => ‘Μέγεθος’,‘
   Hips’ => ‘Γοφοί’, ‘Width’ => ”, ‘Chest’ => ‘Μπούστο’, ‘Bust’ => ‘Μπούστο’, ‘Waist’
   => ‘Μέση’, ‘Under’ => ‘Κάτω από ‘, ‘Bottom’ => ‘Κάτω σύνολο ‘, ); } ?> return
   str_ireplace( array_keys( $map ), $map, $data ); Don’t care of course for the
   Greeks translations.
 * And again excuse me to be so efortic to you.
 * Thank you.
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11746162)
 * Hi [@brandsforless](https://wordpress.org/support/users/brandsforless/)
 * > For sure i need to add a code for make the different function for each import.
 * My suggestion would be to add a second argument to your function so that you 
   can pass the import name (or translation name) to it. For example, the function
   could look like this: [https://paste.ee/p/G3GAC](https://paste.ee/p/G3GAC). Then,
   in the import template, you can decide which translations to use, e.g.:
 *     ```
       [my_translate_data( {data[1]} )] // this uses default translations
       [my_translate_data( {data[1]}, "swimsuits" )] // this uses swimsuits translations
       [my_translate_data( {data[1]}, "shirts" )] // this uses shirts translations
       ```
   
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11761102)
 * [@brandsforless](https://wordpress.org/support/users/brandsforless/) I’m marking
   this as resolved. Let us know if you have more questions regarding the same issue.
 *  Thread Starter [brandsforless](https://wordpress.org/support/users/brandsforless/)
 * (@brandsforless)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11762104)
 * Hi,
    everything works fine. I am very excited about your fast and reliable halp.
   Keep going. Thank you

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘XML feed mapping’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

## Tags

 * [mapping](https://wordpress.org/support/topic-tag/mapping/)

 * 9 replies
 * 2 participants
 * Last reply from: [brandsforless](https://wordpress.org/support/users/brandsforless/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/xml-feed-mapping/#post-11762104)
 * Status: resolved