Post Stumbler WordPress plugin

Posted by Gary King on July 15, 2007
Categories: programming, web

stumbleupon.pngI’m releasing a plugin which I’ll call the Post Stumbler WordPress plugin (originally to be called the “Stumble Upon” WordPress plugin, but it doesn’t use Stumble Upon at all - even though it tries to mimic its functionality) because that will help most people to understand what it does.

After building this, I found a post that was made over at TechCrunch which discusses about how it would be interesting if WordPress could have similar functionality to what Stumble Upon provides, so I hope that this fulfills that need.

What it does

It basically adds functionality to your WordPress blog which allows visitors to view a randomly selected post on your blog, with a higher probability of choosing popular posts, and with the option of only showing recent posts. You also have the option of giving recent posts more chances to be shown to visitors if you think that your most recent posts are more interesting to your visitors.

Example

To see how this works, click on the links in the sidebar on this page which say “random post” and “random recent post”, which are right below the search box. They are self-explanatory.

How to install

The plugin does have a requirement, which is the Popularity Contest WordPress plugin (install it like any other plugin; just upload it to your /wp-content/plugins/ directory and then activate it in your admin panel), so go and install that first.

When that’s done, download and install my plugin like a normal plugin, too. And you’re done! No configuration is required.

There are two important links that you need to link to. They are:

  • http://www.yourblog.com/?stumble
    • Replace yourblog.com with your own blog’s URL, of course. This URL will show the visitor a random post but it gives a higher weight to popular posts, which increases the chances that visitors will land on a popular post. This is a really cool way of hand-holding your visitors to the great posts on your blog, without linking them to specific posts.
  • http://www.yourblog.com/?stumble&date
    • Again, replace yourblog.com with your own blog’s URL. This URL will point your visitor to a random post, again, based on the post’s popularity, but also, based on how recent the post is. More recent posts will have a higher chance of being shown to your visitors. This is especially useful for blogs where posts are more news- and events-based, such as TechCrunch. It is more interesting to read posts that have been written in the past month rather than posts that have been written a few years ago on blogs such as these.

Anyways, please, PLEASE let me know how well this works for you. I have only tested this on a handful of blogs, and so far, it has worked great on them. But, if this plugin brings up posts on YOUR blog that are not popular at all, then do let me know! I’ll try my best to fix them ASAP.

So, I hope you enjoy this plugin!

History

  • 07/07/15 - 1.0
    • plugin release

Popularity: 90% [?]

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. The Blog for DesignCreatology Tuesday, November 30 1999 at 12:00 am EST #

    links from Technoratitop of category page by tweaking archives.php or adding a custom category.php file. ContactNG is a very stylish and small form for your sidebar or a page. News-it lets you to add your posts ( and/or pages ) on the social digg-like http://www.The-News.biz. Post Stumbler adds functionality to your WordPress blog which allows visitors to view a randomly selected post on your blog, with a higher probability of choosing popular posts, and with the option of only showing recent posts.

  2. links from Technoratimore visible spot in your blog. Once a visitor clicks on the link, it will basically pull up a random post. The author of the plugin described that the page that will be pulled up most of the time belongs to the blogs most visited posts. click here to download the plugin >>>>   Blogs Posts Worth Reading : Get many quality PR4 backlinks for FREE - Lorilei of TopTut.com shares her techniques on how to gain quality backlinks for free without using spamming techniques.

  3. Paul Butler Sunday, July 15 2007 at 11:00 am EDT #

    Cool plugin. My favorite part of open source is having people point out the things I overlooked in my code, so I have a few comments that might help you improve a future version:

    In the first SQL statement, you are asking mysql to send back the entire row for each post in the database, including the post body, and a bunch of other information you don’t need. On a busy blog with lots of posts, this might slow things down a bit.

    I’m not sure how the popularity contest table is structured, but wouldn’t $total be the same as $total_popularity?

    $total_posts seems to only used in the else block, maybe the value could be retrieved in the else block as well to save an unnecessary SQL query?

    In the if block,

    (($pop->date - $first_date) / $date_diff) * ($date_diff / $pop->date)

    could be written as

    ($pop->date - $first_date) / $pop-$gt;date

    The elements in $big_array for the else block could be post ids, like in the if block, instead of as arrays.

    It would be more efficient if you krsorted and popped (array_pop) a value from the $big_array after each value was added (except the first one), instead of sorting a huge array at the end. Or if you stored $max_post_id and $max_post_weighted_value (with less verbose variable names, of course) and compared each post’s weight to them, replacing the $max… variables with the current post’s id and weighted value if it’s weighted value is greater.

    Overall, there is nothing urgent here, just some things to keep in mind in the future if you choose to.

    Keep up the great work.

  4. Paul Butler Sunday, July 15 2007 at 11:02 am EDT #

    I made a little typo,


    ($pop->date - $first_date) / $pop-$gt;date

    should read


    ($pop->date - $first_date) / $pop-$>date

  5. Paul Butler Sunday, July 15 2007 at 11:04 am EDT #

    Gah, I did it again. I meant to say:


    ($pop->date - $first_date) / $pop->date

  6. Gary King Sunday, July 15 2007 at 1:21 pm EDT #

    Paul, thanks for the comments. I’ve updated the plugin a bit to incorporate some of your suggestions.

  7. [...] Post Stumbler adds functionality to your WordPress blog which allows visitors to view a randomly selected post on your blog, with a higher probability of choosing popular posts, and with the option of only showing recent posts. [...]

  8. [...] by Matt Mullenweg which weighs all posts evenly and allows you to find a post at random, or the Post Stumbler plugin, which does the same but does a better job of mimicking StumbleUpon, by allowing users to in theory [...]

  9. [...] Plugins Page | Download [...]

  10. Lincoln Wednesday, July 18 2007 at 1:21 am EDT #

    I gave this plugin a try, but every time I clicked on the stumbling link it would always bring me to my latest post. It wouldn’t stumble anything else. :-(

  11. StumbleUpon » Your page is now on StumbleUpon! Wednesday, July 18 2007 at 1:22 am EDT #

    Kramer auto Pingback[...] Your page is on StumbleUpon [...]

  12. Post Stumbler | わーどぷれすっ! Wednesday, July 18 2007 at 10:00 am EDT #

    [...] Post Stumbler WordPress plugin | King Gary [...]

  13. WP Plugins DB » Plugin Details » Post Stumbler Thursday, July 19 2007 at 2:26 am EDT #

    [...] Visit [...]

  14. Xinu Stats Saturday, July 21 2007 at 7:58 am EDT #

    [...] Source Code syntax highlighting plugin за WordPress FeedBurner FeedSmith Link Harvest на Alexaking Google Translate Wordpress Plugin Feed Statistics plugin Post Stumbler WordPress plugin [...]

  15. Jeremy Saturday, July 21 2007 at 11:27 am EDT #

    Very nice. Worked right first time, just as all plugins should. Thanks.

  16. Doodaddy Tuesday, July 31 2007 at 9:28 pm EDT #

    Great plugin, thanks! Just one question: how did you get the “Popular in past 30 days” in your sidebar? The “Popularity Contest” documentation doesn’t seem to have such a function — just akpc_most_popular() and akpc_most_popular_in_cat() — neither of which has a “last 30 days” option.

    Thanks!

  17. Vic Friday, August 3 2007 at 2:06 am EDT #

    This is a great plugin. This type of is priceless for the new kid on the block.

    Thanks

    Vic

  18. WP-SuperBlog.com Monday, December 17 2007 at 11:00 pm EST #

    links from Technoratigoogle, sitemaps, wordpress, plugin. 57 Comment(s) Comment by … More Blog Resources How I created ProBlogger’s “Group Writing Project” WordPress plugin … Tools Collection ” Blog Archive ” WordPress Plugin Releases for 7/17 Tuesday, …More Blog ResourcesMicroID WordPress Plugin Published 2 days, 20 hours ago in Journal. … It combines OpenID federation, with the MicroID (get the Wordpress plugin! … More Blog Resources This plugin creates a sitemap for your WordPress powered site.

  19. Post Stumbler WordPress plugin Wednesday, March 12 2008 at 5:41 pm EDT #

    Kramer auto Pingback[...] click here to download the plugin >>>>  [...]

  20. Ken Nickless Sunday, June 22 2008 at 11:17 pm EDT #

    Thanks for the great plugin. I’ll be installing it on my three blogs right away.

Comments