blog

Posts Tagged ‘plugin’

Yet Another Related Posts Plugin 2.0

Sunday, July 13th, 2008

Well, it’s been a while since I updated my plugin YARPP—in my humble opinion the best related posts plugin for WordPress. ^^ Today I release version 2.0, incorporating a number of important requests and bug fixes:

  • New algorithm which considers tags and categories, by frequent request
  • Order by score, date, or title, by request
  • Excluding certain tags or categories, by request
  • Sample output displayed in the options screen
  • Bugfix: an excerpt length bug
  • Bugfix: now compatible with the following plugins:
    • diggZEt
    • WP-Syntax
    • Viper’s Video Quicktags
    • WP-CodeBox
    • WP shortcodes

Check out the Yet Another Related Posts Plugin page on this site, the page on wordpress.org, or download it directly now!

Markdown for WordPress and bbPress

Wednesday, May 21st, 2008

I like many others am a big fan of John Gruber’s Markdown, a simple typesetting spec for entering text in a clean, legible plain-text fashion and outputting to (X)HTML. Michel Fortin did the fabulous job of porting the Markdown engine to PHP, making it a plugin for WordPress, bBlog, and TextPattern.

I’ve been using Markdown for all my blog posts here. Recently, though, I was in charge of a bbPress bulletin board (the “less is more” sister project to WordPress) for the Shoreland Scav Hunt team, and wanted to use Markdown formatting there. And I wasn’t the only one wanting to do this.

With some experimenting and research into the filters in the bbPress text flow (different than the WordPress one), I was able to make Markdown work in bbPress. This involved adding a special bbPress plugin wrapper to Michel Fortin’s PHP Markdown Extra. I’ve rereleased this plugin as Markdown for WordPress and bbPress, available at both wordpress.org and bbpress.org. Enjoy!

Yet Another Related Posts Plugin

Saturday, December 29th, 2007

UPDATE:

This posting is now outdated… for the latest information on YARPP, please visit YARPP’s very own page on my site, or its page on wordpress.org. If you have questions, please submit on the wordpress.org forum. Thanks!

Description

Today I’m releasing Yet Another Related Posts Plugin (YARPP1) 1.0 for WordPress. It’s the result of some tinkering with Peter Bowyer’s version of Alexander Malov & Mike Lu’s Related Entries plugin. Modifications made include:

  1. Limiting by a threshold: Peter Bowyer did the great work of making the algorithm use mysql’s fulltext search score to identify related posts. But it currently just displayed, for example, the top 5 most “relevant” entries, even if some of them weren’t at all similar. Now you can set a threshold limit2 for relevance, and you get more related posts if there are more related posts and less if there are less. Ha!
  2. Being a better plugin citizen: now it doesn’t require the user to click some sketchy button to alter the database and enable a fulltext key. Using register_activation_hook, it does it automagically on plugin activation. Just install and go!
  3. Miscellany: a nicer options screen, displaying the fulltext match score on output for admins, an option to allow related posts from the future, a couple bug fixes, etc.

Installation

Just put it in your /wp-content/plugins/ directory, activate, and then drop the related_posts function in your WP loop. Change any options in the Related Posts (YARPP) Options pane in Admin > Plugins.

You can override any options in an individual instance of related_posts using the following syntax:

`related_posts(limit, threshold, before title, after title, show excerpt, len, before excerpt, after excerpt, show pass posts, past only, show score);

Most of these should be self-explanatory. They’re also in the same order as the options on the YARPP Options pane.

Example: related_posts(10, null, 'title: ') changes the maximum related posts number to 10, keeps the default threshold from the Options pane, and adds title: to the beginning of every title.

There’s also a related_posts_exist) function. It has three optional arguments to override the defaults: a threshold, the past only boolean, and the show password-protected posts boolean.

Examples

For a barebones setup, just drop <?php related_posts(); ?> right after <?php the_content() ?>.

On my own blog I use the following code with <li> and </li> as the before/after entry options:

Related posts:

No related posts.

Coming soon (probably)

  1. Incorporation of tags and categories in the algorithm. I’ve gotten the code working, but I still need to think about what the most natural algorithm would be for weighing these factors against the mysql fulltext score currently used (and works pretty well, I must say).
  2. Um, something else! Let me know if you have any suggestions for improvement. ^^

Version log

1.0 Initial upload (20071229)

1.0.1 Bugfix: 1.0 assumed you had Markdown installed (20070105)


  1. Pronounced “yarp!”, kind of like this, but maybe with a little more joy:
     

  2. Did you know that threshold has only two h’s!? I’m incensed and just went through and replaced all the instances of threshhold in my code. It’s really not a thresh-hold!? 

Introducing Smartdate

Tuesday, November 27th, 2007

I recently have been working on a WordPress plugin called WP-Smartdate and I’m happy to say that it is hosted at wordpress.org starting today. As some people have noticed, my blog recently has included little links on word like “yesterday,” with a machine readable version of the date reference (called a “microformat” in the biz). Download the plugin and get started!

WP-Smartdate 0.1
4 kb - zip

This blog post describes release 0.1… For the latest description, check out the WP-Smartdate plugin page or mitcho.com/code.

Please comment! I would love to hear your feedback on the plugin.

Description

WP-Smartdate looks for relative date expressions in your blog posts, such as “tomorrow,” “this coming Monday,” “last Friday,” and adds the date reference (like “2007-11-26”) as a machine-readable microformat.

Why Smartdate?

WP-Smartdate was created for three simple audiences:

  1. For the machine: While many professional information retrieval algorithms go far beyond the scope of this program, smartdate helps the process along by adding machine-readable tags to relative date expressions.1 In addition, these machine tags, in turn, help the human: a search on Google for “November 7th, 2007,” for example, will not pull up a document talking about “yesterday,” written on the 8th, but it will pull up the smartdate output of 2007-11-07.
  2. For the human reader: Blog posts are often written in the “now,” using relative time expressions without concern for how the text will be read in the future. WP-Smartdate makes such posts easier to read and comprehend temporally2.
  3. For me: Because I think this sort of thing is fun!

A typology of smartdate date expressions

The following types of expressions are resolved with respect to the speech time—in WP-Smartdate’s case, the blog post date.

  1. simple references: “yesterday,” “today,” “tomorrow,”
  2. next/last DOTW expressions: “next Friday,” “this past Sunday,” “this Monday”

For the future

  • static dates: “January 1st, 2007”
  • duration shift expressions: “5 days ago,” “fourscore and seven years ago”
  • day of the week shifts: “2 Fridays ago”
  • clean up the code!

  1. One could argue that relative dates are a perfect place to use the abbr tag, as they are a sort of natural-language shortcut for more static temporal expressions. In fact, WP-Smartdate’s output also follows the datetime microformat design pattern draft with two caveats: 1. Unfortunately, the datetime semantic class has not yet been set as the standard is a draft. WP-Smartdate uses datetime. See the Date and Time datatype proposal for more information. 2. The current recommendation for datetime pushes for following the W3C datetime profile, which does not support the ISO-8601 time interval specification, which is will be used by WP-Smartdate. 

  2. Even though the abbr tag should only be used for machine reading


© 2006-2008 mitcho (Michael 芳貴 Erlewine).
Proudly powered by WordPress.
Entries (RSS) and Comments (RSS).
The views expressed on these pages are mine alone and do not
reflect those of my employers and clients, past and present.