Wordpress Plugins

URL Path Bug In WordPress.com Video Server

You’ve got to both respect Automattic for releasing their internal code as open source while also giving them a break for not assuring that it works for anybody else. One of their projects, the WordPress.com Video Server is a sophisticated WordPress plugin that handles video transcoding and offers a bit of a YouTube in a box solution for WordPress.

The bug I found is that the code assumes WPMU is running in subdomain mode, rather than subdirectory mode. This assumption causes an ajax request to go to the wrong URL and return the wrong data. The patch simply applies WordPress’ plugins_url() function that debuted in 2.6.

What is David McNicol’s URL Cache Plugin?

The description to David McNicol’s URL Cache Plugin raises more questions than it answers:

Given a URL, the url_cache() function will attempt to download the file it represents and return a URL pointing to this locally cached version.

Where did he plan to use it? Does he envision the cache as an archive, or for performance? Why hasn’t it been updated since 2005?

It caught my interest because I’ve long been interested in a solution to link rot in my blog. A real “perma-permalink” would be very useful.

Wufoo Forms WordPress Embed Shortcode

I tossed this together a while ago, and it even made it in to bSuite for a time, but I don’t have a need for it anymore, and I’m cleaning house.

function shortcode_wufoo( $arg ){
 // [wufoo id=z7x4m0 domain=place.wufoo.com]

 $arg = shortcode_atts( array(
 'id' => FALSE,
 'domain' => FALSE,
 'height' => 500,
 ), $arg );

 if( !$arg['id'] || !$arg['domain'] )
 return( FALSE );

 return( str_replace( array( '%%id%%','%%domain%%','%%height%%' ), array( $arg['id'], $arg['domain'], $arg['height'] ), '<iframe height="%%height%%" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%; border:none" src="https://%%domain%%/embed/%%id%%/"><a href="http://%%domain%%/forms/%%id%%/">Fill out my Wufoo form!</a></iframe>' ));
}
add_shortcode( 'wufoo', 'shortcode_wufoo' );

Download the simple plugin here: wufoo_shortcode.php. Save it as wufoo_shortcode.php, upload it to your WordPress’ wp-content/plugins/ directory, then activate it.

To use it you’ll have to have a Wufoo account and forms. Then simple put in a shortcode like this [wufoo id=z7x4m0 domain=place.wufoo.com] in one of your posts or pages. The result will look like this.

Slideshare WordPress Embed Shortcode

I’m cleaning house in bSuite, and I’ve decided that this shortcode function for embedding Slideshare items in WordPress needs to go. Rather than totally toss it away, however, I’m posting it here in case somebody else finds it useful.

``` function shortcode_slideshare( $arg ){ // [slideshare id=211578&doc=misty-holland-1198496990903941-2&w=425]   $arg = shortcode_atts( array( 'id' =&gt; FALSE, ), $arg );   if( ! $arg['id'] ) return( FALSE );   return( str_replace( '%%id%%', $arg['id'], '
'
)); }   add_shortcode('slideshare', array(&amp;$this, 'shortcode_slideshare')); ```

Tricky Uses of bSuite

After writing the project page for wpSMS I didn’t have much more to say in a blog post announcing it. The cool thing about writing Pages in WordPress is that I can create a taxonomy like /projects/wpsms/ to place them in. The downside is that new pages never appear in the RSS feed.

So I need both the page and a blog post to announce it. I could have simply copied the content from the wpSMS page into a blog post, but that creates confusion and splits the audience between the two pages. Instead, I’m using two bSuite features: the [include] shortcode and the post redirection support.

  1. Create the page.
  2. Start a new post.
    1. In the post body put the include shortcode like this: [include post_id="123" field="post_content"].
    2. In the custom fields put an entry with the key: “redirect” and the full URL to to your page.
  3. Relax, you’re done.

The include shortcode will copy all the content from the page (so you don’t have to manage it twice), and the redirect custom field will tell bSuite to redirect anybody trying to read that post to your page.

Determining Paths and URLs In WordPress 2.6+

WP 2.6 allows sites to move the wp-content directory around, so plugin developers like me can’t depend on them being in a predictable location. We can look to the WP_CONTENT_DIR and WP_PLUGIN_DIR constants for answers, but a better solution is likely to use the X_url() functions. The most useful of those is likely to be plugins_url(). Even better, you can give these functions a relative path and they’ll return a fully qualified URL to the item.

Do WordPress Pages Better With bSuite

WordPress‘ Pages feature makes the popular blogging platform a sophisticated CMS. bSuite adds a few features to make it even better. Write excerpts, tag, and categorize your pages WordPress excerpts are an underused but powerful feature that allow you to explain to your readers why they should read the page you wrote. Tagging and categorization […] » about 300 words