Kythin's Rants

Kythin rants about all kinds of things, but mainly website development, SEO and PC Gaming.

Aug
15
2008

Wordspinner – Free Word Spinner Plugin for WordPress

I got a couple of emails about my last article about the free spinner code, and have made a rather spiffy plugin for WordPress that will do the same thing on any posts or pages on the site.

You can grab it here: http://wordpress.org/extend/plugins/wordspinner/

There is an example of what Word Spinner does in this very page. Hit refresh on your browser and see if you can pick it!

See the included readme file for changelog and useage (it’s easy as pie).

UPDATE: 24th June 2010: BUG & PERFORMANCE FIX. Also, please now post questions at http://www.kythin.com/wordspinner2/

UPDATE 21st June 2010: Multiple Spinner support finally released!

UPDATE 26th Aug 2009: Just upgraded it to be compatible with 2.8.6

34 Responses to “Wordspinner – Free Word Spinner Plugin for WordPress”

  1. kythin Says:

    To have the spinner work for Text Widgets you need to manually edit line 611 of wp-includes/widgets.php so that instead of “echo $text;” it says “echo run_spinner($text);”

    I just did that and now I can cycle affiliate ads that only take a text-widget to add or change. Woo!

  2. weareunderscore Says:

    I really like your plugin, but have most of my content in custom fields, would it be hard to make it work with custom fields?

  3. kythin Says:

    If it’s in custom fields, you’re probably calling them in the template somewhere, right? Use the same kind of logic as in the comment about text widgets and replace the bit in your template that outputs the custom field data with a function call to “run_spinner($whatever-the-variable-is-to-output-your-data)”. Does that make sense?

    e.g. to output a spun version of all the custom fields, use this in your template:

    echo run_spinner(the_meta());

  4. weareunderscore Says:

    yes got it working a treat, the only problem I had it would not spin with the seperator as a tilda? I had a older plugin that wont work with the new version of wordpress, I’ve just imported all those older stories into my new blog.

    Any quick way of changing the ~ to a comma?

  5. weareunderscore Says:

    Actually I used mysql to search and replace, thank’s once again this plugin is great!

  6. Stanley Says:

    I love the idea of a built-in word spinner sitting right on my blog. But I’m having trouble with it for now. I am using this format to separate words { | }.
    But I get this message: Warning: split() [function.split]: REG_EMPTY in (my domain stuff here)……/plugins/wordspinner/wordspinner.php on line 120.
    Any chance you would tell me what this means? I would appreciate it very much. Thanks

  7. kythin Says:

    Glad you got that sorted weareunderscore, thanks!

    Stanly, the reason that isnt working is because the pipe is a special character in regex and php, try using something else to separate the words (you can also do a mysql find and replace like weareunderscore did to fix all your posts at once)

    - K

  8. Nik Says:

    I installed your word spinner but for some reason it mucked up the short codes on my site. The short codes appeared on the web pages. Do you know what is happening here?

  9. kythin Says:

    @Nik: Is it version 1.3 or 1.4? There was a bug in 1.3 that potentially overwrote Text widgets, and now there are completely separate widgets for Spinable text widgets, so you may have to copy/paste things from text widgets into one of the new Spinning text widgets.

    Other than that all I can think of is that maybe the code you’re inserting contains reserved characters

  10. matias Says:

    Hi Kythin, Thanks for this great contribution.

    I want the spinner to run once for each of post and not to change every time page loads. Is that possible ?

    I am not good with PHP and prefer not to mess it up.

    Thanks-

  11. kythin Says:

    @matias Probably, but it contradicts the point of my plugin a bit. The way to do it (if you have a php coder friend) would be to look up the wordpress API and find out what hook runs when an author saves the page, and then wrap that in a spin function call. The problem then is that you would lose all your other options in each set of brackets so you wouldn’t be able to re-edit the page in the same way, which brings it back to defeating the point of the plugin…

    what you could also do, is use this page (or download the code and make the textbox much bigger for longer articles) whenever you want a new article spun once, then copy/paste it into your site;
    http://www.kythin.com/misc/spin.php

    I MAY add something like this to the options pane in a future update, just so it’s a bit less fussing around, but I’m pretty busy at the moment sorry!

  12. siteblaster Says:

    Kythin,

    I must say that I am impressed. Simple, clean and very easy to implement. Kudos to you.

    I have to ask, why did you use “[,]” instead of using the so called standard of “{~}” or the “|” characters?

    And finally, is there a problem changing those three characters within the code? I see where I can change them I just thought I would ask so as to avoid any problems that you may have had.

    Thanks again!

    Buddy

  13. kythin Says:

    @siteblaster Thanks for the kudos! You can change the characters you want to use in the options in the WP admin, The pipe probably won’t work unless you escape it properly, the braces I think should be fine.

  14. siteblaster Says:

    Kythin,
    Thanks for your previous response. I am trying to use this in my footer in a Text: Links widget but it is not working. I am using WP v2.9 so the previous usage instruction does not appear to work as altering line #611.

    So is there a way that it can be used in a more direct way? Like
    echo run_spinner([Keyword Phrase 1,Keyword Phrase 2,Keyword Phrase 3]);

    Thanks!

  15. kythin Says:

    @siteblaster

    You should be able to do something like:
    $somestr = “[Phrase 1,Phrase 2,Phrase 3]“;
    echo run_spinner($somestring);

    It will still use whatever characters you have set in your WP options as the end and separation characters though, so make sure they’re the same.

  16. siteblaster Says:

    Kythin,

    Thanks for your time. If you would look at http://buddyshearer.com/ and then look at the Footer you will see what I am trying to do. Its as if the code is not being processed.

  17. siteblaster Says:

    Hey Kythin!

    I got it working! Never mind and thanks for your plugin.

  18. siteblaster Says:

    Hey Kythin,

    I am having an issue with a couple of my seasoned plugins not working correctly (I missed them before). I was doing some spinning within some plugin’s CSS and HTML code. Works great in that capacity.

    However, a couple of my plugins use short-codes which look like this {someshort-code]. It appears that WordSpinner actually tries to process this and thus that plugin fails.

    I tried changing the WordSpinners delimiter but I have been met with error codes when I try spinning with them. I tried ” { , } ” as well as ” { | } “.

    How would you change them to use a different escape sequence?

    Would is work by just using dual brackets like [[phrase#1,phrase#2,phrase#3]] ?

    Thanks for your time.

  19. kythin Says:

    @siteblaster: In theory that would work, if you set WordSpinner to use double brackets it should stop messing with your other shortcodes.

    They could be anything, actually. They dont have to be the same character, and they dont have to be brackets, e.g. it could be set to use %$some*words*to*spin$% for all it cares. (untested, but should work!)

  20. seoserpent Says:

    @kythin: I see you talk about not being able to use the pipe {|} unless properly escaped. Can you explain what needs to be done to accomplish that? Thanks!

  21. kythin Says:

    it’s a PHP reserved character, so you would need to get into the code of the addon. You will need to add another str_replace(“|”,”\|”,$spintext); or something along those lines.

    it would probably be easier to run a find/replace on your database than code it properly, which is why I didn’t spend any time on it in the first place

    I’ll fix it in a future release (strapped for time in the forseeable future though)

  22. slamriot Says:

    Hi I got the widget, but there is a small problem, when I am trying to make random words for various different links and I use the same words to spin, it creates “STATIC” wording like this (as an example):

    Hi, I’m Jim
    Hi, I’m Joe
    Hi, I’m John

    And I want it to do this:
    Hello, I’m Jim
    Hi there, my name is Joe
    How are you? My name is John

    Is there a way around this flaw, I don’t want it to create the same word or phrase over and over, I am trying to make random “keywords” for internal linking and it is making every keyword the same for each link.

  23. kythin Says:

    Can you tell me the code you’re using to produce these? To make the links as you want above, you’d need 2 or more spinners, e.g:
    (replace [,] with your own characters): [Hello, Hi there, How are you?], [I'm, my name is] [Joe, Jim, John]

  24. silver163 Says:

    Best be a content puller that can spin it as well, helpful in creating a link wheel. I haven’t really even looked at this plugin but seems promising.

  25. kythin Says:

    The plugin doesn’t pull any content, you have to write (or paste) it yourself. It’s out of the project’s scope, and my white hat, to build a content puller.

  26. Alex1234 Says:

    Hi,

    I love your plugin. It’s exactly what I was looking for! Thank you.

    Is it possible to give this the functionality of two level spinning? Such as:

    The [[bucking,kicking] [bronco,steed],[brown,yellow] [dog,mutt]] was just around the corner.

    Thanks,
    Alex

  27. kythin Says:

    Hey Alex; There’s a ton of emails about this so I will be looking into it, hopefully within the next few weeks.

  28. granite Says:

    Hi- I would also very much like to see two level spinning included as I have many pre-formatted articles including this. In the meantime, what happens if you use two level spinning brackets (I suppose the brackets show up in the post, right? when would you be introducing two level spinning.

  29. kythin Says:

    By popular demand, Wordspinner 2.0 has just been released, featuring multi level spinning :) Please be sure to back up your spinner widget texts before updating, though I haven’t touched the code that handles them it never hurts to backup anyway!

  30. pikachu Says:

    Is there a maximum number of sets of spin syntax that Wordspinner 2 will support? If I use a standard length article with word replacement and one level of spin I get this error: Fatal error: Maximum execution time of 30 seconds exceeded in /home/****/public_html/wp-content/plugins/wordspinner/wordspinner.php on line 245
    But if I use just a paragraph or two it seems to be fine.

  31. kythin Says:

    Hi Pikachu,

    I just tested it on an absurdly long article and it worked – took about 5 – 10 seconds to load – but it worked. Maybe you have an error in your syntax somewhere?

    Edit: Or possibly your server is a slow machine?

    Edit2: Pika can you please email me the article you’re trying to spin so I can test it properly – kythin {at} gmail. I’ll run it through my development version and see what’s going on! :)

    - K

  32. Alex1234 Says:

    Hi Kythin,

    Thanks for the update!

    I also got the error message listed above. I have just found that you updated it again however. Was that a fix?

    Alex

  33. kythin Says:

    @Alex Yep that should greatly increase the performance and stop that error coming up!

  34. pikachu Says:

    Sorry I wasn’t able to email a document but by the looks of it, everything works now! Pages are loading a lot quicker now thanks!

Leave a Reply

You must be logged in to post a comment.