Hi @dorgs04
If your custom field set up looks like this in ACF: https://d.pr/i/aIvRJK, you’ll have to import the values on the left in WP All Import. So, for example, to select “Test C”, you’d import this under “Set with XPath”:
<a href="http://localhost:8888/testsite/">Test</a> C
If that doesn’t work for you, please replicate the problem at http://wpallimport.com/debug and open a ticket at http://www.wpallimport.com/support/ with the details.
Thanks for the quick reply.
I’m still not sure how to apply the different values to the XPath field. If you can explain alittle more, I’m sure I can use this.
I did manage to achieve my required results partly using the Custom Fields, Field Options, Mapping. Only problem, the links or html aren’t saved to the template under ‘Translated To’ the template to use again.
Is there a way to get the ‘Translated To’ field to save the html im adding?
But Im not sure if this is the best way to proceed.
Thanks again for your help.
Thanks again for all your
Hi @dorgs04
I’m still not sure how to apply the different values to the XPath field.
You’d import a comma delimited list of the values in the “Set with XPath” option for your field, inside the ACF Add-On section: https://d.pr/i/RmlRkf.
I did manage to achieve my required results partly using the Custom Fields, Field Options, Mapping.
Importing via the Custom Fields section wouldn’t work for ACF fields. If you need to map the HTML values, you should use a custom PHP function to do it instead: http://www.wpallimport.com/documentation/developers/execute-php/. Example snippet:
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;
}
Many thanks
The function array worked perfectly.
Is there a way to use this to select/output multiple values?
Many thanks
Hi @dorgs04
Is there a way to use this to select/output multiple values?
Do you mean that you need to apply the same mapping rules to multiple elements? If so, you could adjust the function like this:
function my_translate_data( $data = array() ) {
$map = array(
'Red Post' => 'Awesome Post',
'Green Post' => 'Crazy Post',
'Blue Post' => 'Insane Post'
);
$data = implode( ",", $data );
return str_ireplace( array_keys( $map ), $map, $data );
}
Then pass your elements to it as an array:
[my_translate_data(array({element1},{element2[1]},{element3[1]}))]
Hi @dorgs04
I’m marking this as resolved since we’ve not heard back. Let us know if you still have questions regarding this issue.