Variables into spin
-
Hi
Im trying to import a csv with a spintax, i have a very similar issue that this topic https://ww.wp.xz.cn/support/topic/variable-data-not-recognized-with-nested-spintax/
It doesnt recognize de variable, https://prnt.sc/6zODDjF1OCfO
I have this 3 functions
function my_process_spintax( $text ) {
return preg_replace_callback( ‘/\{(((?>[^\{\}]+)|(?R))*)\}/x’, ‘my_replace_spintax’, $text );
}function my_replace_spintax( $text ) {
$text = my_process_spintax( $text[1] );
$parts = explode( ‘|’, $text );
return $parts[ array_rand( $parts ) ];
}function my_custom_spintax( $text1 = ”, $options ) {
$output = ”;
$output .= my_process_spintax( $text1 ) . ‘ ‘;
$options = ‘{‘ . implode( ‘|’, $options ) . ‘}’;
$output .= my_process_spintax( $options );
return trim( $output );
}[my_custom_spintax({descripcin[1]},array({nombre216[1]},{rating[1]}))]
How can i keep the variable in the spintax so wp all import can replace for the value in the csv? Can someone help me?
Thank you so much in advance
The topic ‘Variables into spin’ is closed to new replies.