Something like that could work, but you might find it a bit easier to use a full PHP function, as described here: http://www.wpallimport.com/documentation/developers/execute-php/
Not the best with PHP, any examples of scripts/functions other users are using?
For you, it would be something like this (can be pasted in to the Function Editor):
function export_agent_lookup( $agent ) {
$replacements = array(
"john-doe" => "John Doe \ Manager",
"penny-doe" => "Penny Doe \ Assistance manager"
);
return str_replace( array_keys($replacements), $replacements, $agent);
}
You can read more about using PHP functions here: http://www.wpallimport.com/documentation/developers/execute-php/
Nice one guys π
Is it possible to have an option for both agents too?
So both John & Penny Doe together?
I’m sort of thinking going by your code above
function export_agent_lookup( $agent ) {
$replacements = array(
"john-doe" => "John Doe \ Manager",
"penny-doe" => "Penny Doe \ Assistance manager"
"john-doe,penny-doe" => "John Doe \ Manager,Penny Doe \ Assistance manager"
);
return str_replace( array_keys($replacements), $replacements, $agent);
}
Trialing this atm
[export_agent_lookup({listingAgent[1]})] in field
function
function export_agent_lookup( $agent ) {
$replacements = array(
"1" => "John Doe β Director\Licensee\Sales Agent",
"2" => "Penny Doe β Sales Agent",
"1" . "2" => "John Doe β Director\Licensee\Sales Agent" . ">" . "Penny Doe β Sales Agent"
);
return str_replace( array_keys($replacements), $replacements, $agent);
}
not sure if it will work, your thoughts?
I’m not sure, but you can run as many tests as you like here: http://www.wpallimport.com/debug/
Don’t know if this helps, I select agents in WordPress like this http://imgur.com/wfNIYI9
Which uses the MetaBox plugin
You can see a block of code that generates a list of agent posts titles to use in Metabox Options around line #52 in the βconfig-meta-boxes.phpβ file located under framework/meta-box/ directory.
Look at this screenshot: http://jmp.sh/iAe8gpc
Now you can find the MetaBox field code around line #320 in the same file.
Helping screenshot: http://jmp.sh/9OHQWEb
So essentially I just have to make my function select two ID’s in the agent_post->id in the agents_array
I wonder if I can just reuse this code for my import https://jumpshare.com/v/q49tAdr5kEsH9u9NEakz
Can I just put two XML tags in the one field like ?
{listingAgent[1]},{listingAgent[2]}
ok that did not work, have created a demo site at http://hmavjvlp.testdrive.rodeo/wp-admin
Pretty close to getting it to work.
When only one field is available, how do I import 2 xml tags into one field to make them seperate from each other?
So instead of “John Doe, Penny Doe” it displays as
“John Doe”
“Penny Doe”
Unfortunately writing/modifying custom code is outside the scope of what we’re able to offer. We do have a list of developers here who would be able to help: http://wpallimport.com/developers/