Spintax function not working
-
hello
I tried the spintax function you posted here: https://paste.ee/p/GluOL
and pasted it in the function editor as: (see below)
but it’s not spinning my spintax when I preview ! what should I do ?
<?php
function my_spintax( $string ) {
$data = preg_match_all( “/(?=\{).*?(?=\})./”, $string, $match );if ( !empty( $match ) ) {
foreach ( $match as $key => $value ) {
if ( !empty( $value ) ) {
foreach ( $value as $values ) {
$v = explode( “|”, $values );
$i = array_rand( $v );
$string = str_replace( $values, str_replace( array( “{“, “}” ), “”, $v[ $i ] ), $string );
}
}
}
}
return $string;
}
?>
-
Hi @nicoco35
After the code is saved in the Function Editor, you’ll need to make sure that you’re passing your import elements with spintax to the function, for example:
[my_spintax({title[1]})] [my_spintax({content[1]})]Read more on this here: http://www.wpallimport.com/documentation/developers/execute-php/.
Hi, thanks, but that’s still very unclear. Where do I put my spintax ? inside the csv ot the content box of the importer ? I cannot put it in the CSV as a custom field, its 3000 words. i cannot put 3000 word spintax in a every single cell of my post descriptions. I need to put it inside the content box of wp all import
please explain clearly how to do step by step. thanks
what I need is
spintax {custom field 1} spintax {custom field 2} spintax.
etc….
-
This reply was modified 7 years, 10 months ago by
nicoco35.
thats what I need to do:
Hi @nicoco35
i cannot put 3000 word spintax in a every single cell of my post descriptions. I need to put it inside the content box of wp all import
You’ll need to pass the entire text content, including the spintax, to your function inside the content area of the import. Example:
[my_spintax("{Based in|Located in|Situated in} London {and working|and running sessions} {through|via|over} skype {all around the world|all across the globe|worldwide|all over the world} {at Space to Evolve|at Space to Evolve} {our entire focus is to|our number one aim is to} {help you to|assist you to|guide you to} {lising the greatest vision|live the highest calling} of your life.")]See: https://d.pr/pwfgBz.
hello
Thanks it works, but my other issue is that spining paragraphs does not work. I need to be able to shuffle paragraphs using my wordai spintax, however it does not work
here is what wordai gives me to shuffle paragraphs. unfortunately it s not working in wp all import:
{Jakarta, Indonesia (CNN)First responders are {racing|rushing} to evacuate hundreds of {people|individuals} affected {by|with} a deadly earthquake {that|which} rocked {some|a number} of Indonesia’s most {idyllic|scenic} islands late Sunday night.
{The number|The amount} of {victims|sufferers} is expected to {rise|grow} as rescue efforts continue. {The majority of|Nearly all} those killed in the quake were {hit|struck} by falling debris from collapsed {buildings,|buildings,”} {said|stated} Sutopo Purwo Nugroho, the head of Indonesia’s {disaster|crisis} management {department|section}. Authorities reported {more than|over} 200 were {injured|hurt}.
At least 91 people, {all|all of} Indonesian nationals, were killed when the 6.9-magnitude quake struck the popular tourist island of Lombok, Indonesian {authorities|government} said Monday. Authorities reported {more than|over} 200 were {injured|hurt}.
|Jakarta, Indonesia (CNN)First responders are {racing|rushing} to evacuate hundreds of {people|individuals} affected {by|with} a deadly earthquake {that|which} rocked {some|a number} of Indonesia’s most {idyllic|scenic} islands late Sunday night.
{The number|The amount} of {victims|sufferers} is expected to {rise|grow} as rescue efforts continue. {The majority of|Nearly all} those killed in the quake were {hit|struck} by falling debris from collapsed {buildings,|buildings,”} {said|stated} Sutopo Purwo Nugroho, the head of Indonesia’s {disaster|crisis} management {department|section}. Authorities reported {more than|over} 200 were {injured|hurt}.
At least 91 people, {all|all of} Indonesian nationals, were killed when the 6.9-magnitude quake struck the popular tourist island of Lombok, Indonesian {authorities|government} said Monday. Authorities reported {more than|over} 200 were {injured|hurt}.
|
{The number|The amount} of {victims|sufferers} is expected to {rise|grow} as rescue efforts continue. {The majority of|Nearly all} those killed in the quake were {hit|struck} by falling debris from collapsed {buildings,|buildings,”} {said|stated} Sutopo Purwo Nugroho, the head of Indonesia’s {disaster|crisis} management {department|section}. Authorities reported {more than|over} 200 were {injured|hurt}.
At least 91 people, {all|all of} Indonesian nationals, were killed when the 6.9-magnitude quake struck the popular tourist island of Lombok, Indonesian {authorities|government} said Monday. Authorities reported {more than|over} 200 were {injured|hurt}.
Jakarta, Indonesia (CNN)First responders are {racing|rushing} to evacuate hundreds of {people|individuals} affected {by|with} a deadly earthquake {that|which} rocked {some|a number} of Indonesia’s most {idyllic|scenic} islands late Sunday night.}looks like nested spintax does not work !
Hi @nicoco35
looks like nested spintax does not work !
That’s correct, the example code we previously provided does not handle nested spintax. You’ll need to adjust the code to make it work with your paragraphs.
Hi @nicoco35
Unfortunately, we cannot write custom code for your project.
i dont need u to write a custom code, its just a few values more to add to the existing code. your plugin is so pricey at least provide some help for the people using it
would that help? https://gist.github.com/irazasyed/11256369
i tried the nested spintax code function from github and it does not even work in WP all import
i tried again, and adapted /\{(((?>[^\{\}]+)|(?R))*)\}/x instead of your own value. which proves u really did not make any effort to help me solve that issue. it was not much work ! and i have zero knowledge of coding.
now it works
Hi @nicoco35
That’s correct – we are happy to help you use the software you’ve purchased, but we are not able to write or troubleshoot code for you. In any case, happy to hear you were able to find a solution!
-
This reply was modified 7 years, 10 months ago by
The topic ‘Spintax function not working’ is closed to new replies.