Warning : if you don’t have php knowledge then please don’t use this feature.
shortcode allow user to filter or modify import data. user can call any php function and pass any number of argument.
Required permission for non admin users
by default adding shortcode is allowed for admin users only. admin can give permission to any user role.
for add permission go to WP Imp Export => Settings
How to use shortcode
[wpie_function custom_function=”my_custom_function” param1=”value1″]
wpie_function: shortcode name
custom_function : fixed variable for use custom function
my_custom_function : any php function name that you want to call
param1=”value1″ any parameter you pass. you can pass unlimited parameters.
Example 1 : multiply values
[wpie_function custom_function="increase_my_price" data1="{price[1]}" data2="20" data3="50"]
here {price[1]} is drag and drop field from list. it may change in all files. data1, data2, data3 are parameters and you can pass unlimited parameters
add function in themes function.php file
function increase_my_price( $data = [],$content="" ) {
$data1= isset( $data[ "data1" ] ) ? $data[ "data1" ] : 1;
$data2 = isset( $data[ "data2" ] ) ? $data[ "data2" ] : 1;
$data3 = isset( $data[ "data3" ] ) ? $data[ "data3" ] : 1;
return $data1 * $data2 * $data3;
}
Example 2 : add prefix
[wpie_function custom_function="add_my_prefix" data="{custom[1]}" prefix="test_"]
here {custom[1]} is drag and drop field from list. it may change in all files. data, prefix are parameters and you can pass unlimited parameters
add function in themes function.php file
function add_my_prefix( $attr = [],$content="" ) {
$data= isset( $attr[ "data" ] ) ? $attr[ "data" ] : "";
$prefix= isset( $attr[ "prefix" ] ) ? $attr[ "prefix" ] : "";
return $prefix.$data;
}
Example 3 : Replace link in content
[wpie_function custom_function="replace_my_links" data="{content[1]}" search="http://demo.example.com" replace="http://www.vjinfotech.com"]
here {content[1]} is drag and drop field from list. it may change in all files. data, search and replace are parameters and you can pass unlimited parameters
add function in themes function.php file
function replace_my_links( $attr = [], $content = "" ) {
$data = isset( $attr[ "data" ] ) ? $attr[ "data" ] : "";
if ( empty( $data ) ) {
return "";
}
$search = isset( $attr[ "search" ] ) ? $attr[ "search" ] : "";
$replace = isset( $attr[ "replace" ] ) ? $attr[ "replace" ] : "";
$new_content = str_replace( $search, $replace, $data );
return $new_content;
}