Tagline Randomizer

So I've written another plugin for WordPress. This one is nowhere near as groundbreaking as X-Comments but it's something I've wanted for this site for a while and couldn't find anything anyone had already written that did it the exact way I envisioned it. Anyways, here's the skinny…

What Does it Do?
Tagline Randomizer changes the tagline displayed on your site each time the site is accessed. The values used are added by the blogowner from the Options panel of the Administrative Menu.

How Does it Do it?
When Tagline Randomizer is activated, your current tagline is copied to a new textfile in your wp-admin folder called tr_taglines.txt. Then, each time your blog is accessed (more specifically when the 'init' Activity hook is run), Tagline Randomizer reads all available taglines from the text file and randomly selects one to replace the current tagline value in your database. That tagline is then displayed on your blog wherever your template displays such a value.

How Do I Use It?
Easy. Simply copy the tagline_randomizer.php file to your wp-content/plugins folder and Activate the plugin from the Plugins panel of the Administrative Menu. Once you've done that, go to your Options panel and click the new Tagline Randomizer submenu. On that page, you'll have a text box that you can enter as many taglines as you would like. Enter each tagline on a separate line, click the Update Options button, and you're all done! Your visitors will now start seeing a random tagline from your list each time they visit your site.

Release Notes

  • Version .99 BETA - Released 2006-03-19
    • First release as Beta just to cover my own ass.

Known Bugs

  • “Refreshing” your browser window does not cause the tagline to change. Not actually a bug but it's worth mentioning.
  • For some reason the first time you activate the plugin, your tagline may appear blank. Leave your site and come back to it. Everything should work fine from that point on.

Future Enhancements
Right now this plugin does exactly what I wanted it to do so I'm not really looking to expand on it, however that may change in the next few weeks, days, hours… you never know. If there is something along these lines you would like to see implemented, add a comment or shoot me an email. I'm always willing to make changes if it will get more people to use one of my plugins. With that said, here are a couple things I could possibly see users wanting

  • Ability to accept an RSS feed of quotes/sayings from some Quote/Saying site to be updated automatically
  • Preference to showing recently added taglines more often than older ones.
  • Seasonal or date triggered taglines to wish your visitors “Happy X-Holiday” or to tell your users it's your own birthday or something.

And Finally, Why Did I Not Use One of the Other Tagline or Quote Thingys
There are two reasons, the first being that I didn't see any plugins that acted in this exact way and this was the way that I wanted it to work. To be honest, I didn't really look very hard or long for such a plugin which brings us to point two. I really just felt like writing my own plugin to do this. So there ya have it! I'm not saying Tagline Randomizer is any better than any of the other tools out there that do similar things, but it does what I want and does it the way I want it to. I hope you find some enjoyment out of it, too.

55 Responses to “Tagline Randomizer”

  1. panoptican Says:

    I just spent the other day looking for something like this. Very nice work.

  2. dpb Says:

    Glad to be of service! Let me know how it works out for you!

  3. panoptican Says:

    I've actually yet to get it to work. For some reason, it's not writing the txt file manually when I activate the plugin. I don't think it's a permissions issue. I wrote a file manually and dropped it into the plugins directory but I was still having problems. Once I figure out how to make it work though, well, that will be glorious.

  4. panoptican Says:

    That first “manually” should of course be “automatically.”

  5. dpb Says:

    In which folder did you manually create a file? The plugin will attempt to write it in the wp-admin folder.

  6. panoptican Says:

    Well that semi-solved it. The file is read and my list of taglines are now presented in the text box when I go into options. On the site though, the taglines don't randomize. The last in the list is shown no matter what. At ;east as far as I can tell. Maybe I'm having a long run of coincidence on all of these shift refreshes.

  7. dpb Says:

    Actually, refreshing the page doesn't seem to trigger the hook that is necessary to initiate the plugin but I've been going to your site over and over again and not seeing a change either. That's odd. Stupid question… is the plugin still activated?

  8. panoptican Says:

    Stupid answer… no. Doh. I just activated it again though and now my tagline has vanished. I checked in the options panel and in the actual text file for any extra blank lines but there doesn't appear to be any.

    5 minutes later. So I'm, playing around with it right now and I'm getting some weird behavior. Basically, if I add an additional tagline it sort of starts working again. A random one will appear but after that, it remains.

    Anyway, don't want to clog up your comments (and you're so close to 1000, it would be a shame if I took it on a support question) so if you'd like to take this to email or im: jason at panoptican dot org, flannelmouthed on aim.

  9. dpb Says:

    Hehe, thanks, but I'm not too worried about my 1000th comment ;-) and I actually like having this dialogue recorded for all to see in case they run into similar problems. Speaking of which…

    I've noticed that when the plugin is initially activated, it blanks out the tagline. I'm not sure why, but the next time the site is accessed, you're money. You can't refresh the screen (unfortunately) to cycle through the taglines so you've got to leave your site and come back … for me that's easy to do by going to my admin page and then clicking back to the site page. I can see the changes very easily that way.

  10. panoptican Says:

    I guess the question then becomes: are you seeing any different taglines on my site? The blank problem seems to have been solved but it doesn't seem to be changing. Right now I see “Maybe it cycles.” I opened up the site in IE and in Firefox in case Opera's ultra-caching was the problem and I still only saw that tagline.

    On another note, I wasn't able to see other taglines on your site at first. But after restarting my browser, I see a new one. So maybe that means something.

  11. panoptican Says:

    It just worked. Is there a time-based property to the randomizer? Anyway, slow randomization works just as good as fast ranomization being that 99% of my visitors stop by once a day. That 1% who refresh it constantly is me so that shouldn't be a problem. Cheers and thanks much for your help. It will now be added to my list of sprinkles.

  12. Selfish Crab » Blog Archive » like my civic Says:

    [...] Added a tagline randomizer so I can use more than one pithy subtitle. [...]

  13. Roger Weeks Says:

    Hm, so I've installed it, and first it didn't have permissions to write to the wp-admin folder.

    Then, once that was fixed, I activated it, added items to the tagline, and now I have no tagline at all.

    Thoughts?

  14. Roger Weeks Says:

    Er, so after a while… at least a few minutes, and several different browser restarts, and tries of different browsers, it now works.

    ?

  15. El tagline, ahora lo escribes tú | Sólo otro blog infame Says:

    [...] Primero encontré un plugin que te permite definir una serie de frases y que éstas se muestren de forma aleatoria pero eso no es lo que yo buscaba, yo quería algo que me dejara cambiar de tagline cómodamente y lo más rápido posible. [...]

  16. jeremy.lonien.de » Blog Archive » Updates voraus! (3) Says:

    [...] Hm, was hat sich noch geändert? Die Tagline, also das stückchen Text rechts oben neben dem Blognamen, ist nun (testphase) durch das Wordpress-Plugin Tagline Randomizer (wer hätte das gedacht?) randomisiert. Das ganze läuft recht einfach ab: Das PHP-script wählt sich einen der durch Zeilenumbrüche getrenten Textschnipsel aus, und zeigt ihn oben an. Das geschieht nur (anders als beim random header) irgendwie nicht bei jedem Zugriff. [...]

  17. Kyle Korleski Says:

    All I've got to say is that this hack desperately needs to be fixed.

  18. dpb Says:

    Fortunately you provided me with all the information I needed to fix it. What problems are you experiencing Kyle? I would be more than happy to look into any issues. So far, I've got 100s of people running it w/o issue (at least a reported issue).

  19. Florian Blatt Says:

    Hi,

    nice plugin. I think I have fixed the blank tagline bug. You forgot to substract one from $x.

    change
    update_option('blogdescription', $buffer[mt_rand(0,$x)]);
    to
    update_option('blogdescription', $buffer[mt_rand(0,$x-1)]);
    (I use the Mersenne Twister random function instead of the normal rand function).

  20. Florian Blatt Says:

    I just realised an error of my own. I had set $x = 0 instead of $x = 1 so you should change the rand function to something like mt_rand(1, $x-1). Sorry for this double commenting.

  21. Deb Says:

    Great plugin, does exactly what I need it to. I had to change the permissions for wp-admin; it might be worth adding that to the documentation.

    Thanks for the good work :-)

  22. dpb Says:

    Thanks Florian and Deb!

  23. Kyle Korleski Says:

    The blog with the problem is http://www.rexanni.com/blog/ . Basically, the random taglines aren't appearing. WTF?

  24. dpb Says:

    Not sure what your problem is Kyle. Can you tell if the text file is being created? Are you getting any type of error messages?

  25. Kyle Korleski Says:

    The text file is being created, it's just an issue of the taglines appearing.

  26. karraskal.homelinux.org » Blog Archive » Taglines aleatorios para Wordpress Says:

    [...] David se ha currado un sencillo plugin para Wordpress que permite que el «Tagline», es decir, la pequeña descripción que suele acompañar al título del blog, cambie de forma mas o menos aleatoria entre unas cuantas que tengamos preparadas, al mas puro estilo Futurama. Y funciona porque lo tengo aqui puesto. [...]

  27. Kevin Says:

    I don't know whether these were mentioned earlier or not, didn't read ALL of the comments.

    #1.) Blank tagline: Florian Blatt's post fixed it.

    #2.) Tagline file problem: I used the absolute path to the tagline file. I was confused when PHP gave me the error the file did not exist when it was there and chmodded properly. Does Wordpress change the working directory?

    Chances are I won't be back ^_^ so don't bother replying to me.

  28. Deb Says:

    Erk, now I'm having problems similar to some of those mentioned above.

    I changed my theme, and now the tagline doesn't randomize. If I go to the Tagline Randomizer options and update, it changes the tagline - and I get that same tagline forever (well, I haven't tried forever, but you know what I mean), and it's the same tagline on all pages on my blog, on all browsers. I can also get it to change by going to the WP Options page - just refreshing that will change the tagline, and then I get the tagline shown there, but it stays with the same tagline until I do that again.

    Any ideas?

  29. dpb Says:

    No clue Deb, that's an odd one. I'll look into it.

  30. victor Says:

    Hello, Your Tagline-Randomizer plugin is very useful for my blog. Do you think you can port it to Wordpress 2.1.

    It would be great!

    Thanks and sorry for the English, I'm Spanish.

  31. dpb Says:

    victor, it should work on WP 2.1

  32. victor Says:

    Sorry,

    It's true. It was an error with the database. All the taglines stored were deleted when wordpress was updated.

    Thanks for all.

  33. dpb Says:

    victor, that's odd as Tagline Randomizer does not use the database at all.

  34. sThig Says:

    Hi there,

    Your Randomizer was easy enough to set up however it's not working. It did write the text file and everything seemed to “take” but there are no random taglines being put up, just the same one I had before.

    In my profile part, should I leave my tagline blank to activate it?

    Could you please help, I'd really like for this to work.

    Thanks! It looks kickass and I'd love for it to work!

    Best
    Scott
    http://www.sthig.com

  35. sThig Says:

    oops, spoke too soon. Now it works

  36. Dan Says:

    I'm currently doing a build on a home server, to change over to my main site at the end of the month.

    The only time the tagline seems to change is when I refresh in the dashboard - but not on any of the pages. I leave, I come back, I use a different browser… even to different computers.

  37. dpb Says:

    That's strange Dan, I'll have to look into it.

  38. Dan Says:

    I'll provide you with more details, if that helps.

    I'm actually running it off of Wordpress MU, not a straight install of Wordpress. The theme it's being used with is a modified version of Comicpress.

    You can see my stuff (under construction) at http://65.111.164.35.

    I don't think it a huge problem - I mean, it changes when I update something in Admin, so it is technically working. It's not just the General Options page - basically if I edit a post, or upload a file, it changes - but only then.

    Wierd, eh?

  39. duane Says:

    dave, does mine change when you click on new posts or reload the page? Because I might be having the same issue. It only changes when I open it from the dashboard.

  40. spaimuntgp Says:

    Hello! Good Site! Thanks you! hjjzbjvpmu

  41. nick Says:

    I am using the DePo theme and this does not seem to be working for me I did every thing you said but it only changes when I refresh my options page in the wp-admin, not when I refresh my site.

  42. David Chartier Says:

    I tried using this with my WordPress 2.2 blog and it doesn’t seem to work. I clear out the tagline from the options page and enter a few into your plugin as described, but taglines don’t randomize on the site, even after turning off the wp-cache plugin. Were there any major changes in recent WordPress releases that might’ve broken tagline randomizer?

  43. Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 8/8 Says:

    [...] Tagline Randomizer changes the tagline displayed on your site each time the site is accessed. The values used are added by the blog owner from the Options panel of the Administrative Menu. (No Ratings Yet)  Loading … Sphere: Related Content [...]

  44. Nico Nemil | Web Developer | Web Designer | Graphics Artist » WordPress Plugin Releases for 8/8 Says:

    [...] Tagline Randomizer changes the tagline displayed on your site each time the site is accessed. The values used are added by the blog owner from the Options panel of the Administrative Menu. Filed under Technology by Permalink • Print • Email • Comment [...]

  45. Tagline Randomizer | わーどぷれすっ! Says:

    [...] Tagline Randomizer | davidpbrown.net [...]

  46. Jeff A Says:

    Same problem. It only changes when I refresh the options page!

  47. Ingo Vogelmann Says:

    When it’s date triggered i’m into it. For now WP-Quotes does a perfect job mate.

  48. Frank Says:

    David, love your plugin. Are you looking at changing it at some stage so the tagline changes with every new page load?

    Cheers
    Frank

  49. Random WordPress Plugins: Rotating Banners, Header Art, Images, Quotes, and Content on Your Blog « Lorelle on WordPress Says:

    [...] Tagline Randomizer and Random Title WordPress Plugin put random text in your blog’s header’s tagline or subtitle which changes with each page refresh. [...]

  50. John I. Carney Says:

    Since I upgraded to 2.3 beta1 (I’m now using beta2, with the same problem), if I go to my tagline randomizer options, instead of my list of taglines I see some code in the entry window.

  51. Lake Neuron » Plugin problem Says:

    [...] Tagline Randomizer apparently doesn’t work with either of the beta versions of WordPress 2.3 which have been released so far. [...]

  52. toadaly Says:

    Heh, everytime I think I’m going to have to write code, someone else has already done it!

    You might enjoy what I’m using it for http://www.aohwell.com

    The only drawback I’m seeing, is that the text extends the full width of the frame. It would be nice if it could be limited to a smaller width, since in general, the caption images are smaller than the frame.

  53. kmorey.net » Random Tagline WordPress Plugin Says:

    [...] Tagline Randomizer [...]

  54. Mark Says:

    Any chance you could update the plugin to either store the quotes in the database with one’s WordPress install or at least put the text file under wp-contents? Just realized I lost all my quotes when upgraded to the lastest version of WordPress (deleted all old files first, including the wp-admin directory).

  55. dpb Says:

    Ah, yeah… I need to update this plugin. Good suggestion.

Leave a Reply