Nested Spin function
-
Hello,
I have been doing good with the spin formula posted here: https://paste.ee/p/GluOL
But, in my case I need to spin more words (synonyms) inside spintax, so I’d need to implement a nested spin. However, the formula I usually apply in php is not working in Wp All Import.
This is the formula:<?PHP
class Spintax
{
public function process($text)
{
return preg_replace_callback(
‘/\{(((?>[^\{\}]+)|(?R))*)\}/x’,
array($this, ‘replace’),
$text
);
}
public function replace($text)
{
$text = $this->process($text[1]);
$parts = explode(‘|’, $text);
return $parts[array_rand($parts)];
}
}How can I adapt it to WP All Import??
Thank you for this awesome Plugin. Best Regards,
- The topic ‘Nested Spin function’ is closed to new replies.