Using shortlinks with Jetpack Sharing

At present, Jetpack doesn’t use shortlinks when visitors share your content through the built-in Sharing module. With length-limited services like Twitter, this can be a problem. Take, for example, http://ethitter.com/2013/05/using-shortlinks-with-jetpack-sharing/ versus http://eth.pw/s; the latter frees up many more precious characters.

Thankfully, the folks who built the Sharing module provided a filter to override the link used with the sharing buttons.

Add this snippet of code to your theme’s functions.php file, or a file in your site’s wp-content/mu-plugins directory, and your visitors will be sharing with shortlinks in no time.

/**
 * Force Jetpack's Sharing module to use a shortlink rather than full permalink
 *
 * From http://eth.pw/s
 *
 * @param string $url
 * @param int $post_id
 * @uses wp_get_shortlink
 * @filter sharing_permalink
 * @return string
 */
function eth_sharedaddy_shortlink( $url, $post_id ) {
	return wp_get_shortlink( $post_id );
}
add_filter( 'sharing_permalink', 'eth_sharedaddy_shortlink', 10, 2 );

Note that the Publicize module, which handles automatically sharing your content to your own connected social media accounts, does use shortlinks already; therefore, the code snippet above won’t have any impact on Publicize.

Also, I opted not to make this a plugin in anticipation of Jetpack making the switch to shortlinks at some point.

Updating all the plugins!

As part of checking that that the plugins I maintain are ready for WordPress 3.6, I took the opportunity to fix a number of bugs, patch a few content disclosure vulnerabilities, and refactor some things I wasn’t pleased with.

Below is a rundown of all that changed. It’s worth noting that all of the plugins I actively maintain are compatible with WordPress 3.6, which will be released in the coming weeks.
Continue reading

I spent today checking all of the plugins I contribute to, ensuring that they are compatible with WordPress 3.6. Beta 3 was released last night, so we’re getting closer to a stable release.

If you’re a plugin author, have you done the same?

Surviving My Nomadic Lifestyle

I spend a lot of time on the road–ten trips covering 36,952 miles and 26 cities in 2013 so far–and my nomadic lifestyle often comes up in the context of “where are you from” inquiries. A frequent question is how I deal with being away for so long, always on the go, particularly given the unsettled nature that comes with living out of a suitcase. Having lived like this since July 2012, I’ve refined my approach to travel such that I’m not bothered by constantly relocating.

Continue reading

The Power of WordPress’ Roles and Capabilities–Portland WordPress Meetup

At tonight’s Portland WordPress meetup, I’ll present a combined version of my two talks on WordPress’ Roles and Capabilities system. I’ve given these talks before, most recently at WordCamp Toronto 2012 and WordCamp Toronto Developers 2012.

So those in attendance can follow along, below are the slides I’ll use as part of the discussion:

My appearance at PDXWP was described as follows:

WordPress’ roles seem simple enough on the surface, but behind the Administrator, Editor, and the other default roles is a powerful system that can be customized extensively. For April’s PDXWP Developer’s meetup, Erick Hitter, Lead of Team Custom at Automattic, is joining us to talk about WordPress roles and capabilities.

While some have said that other CMS’ have an advantage when it comes to security and customizing capabilities, Erick will demonstrate that that isn’t true. Starting with a walkthrough of how to modify existing roles and create new ones, he will then cover how to leverage custom roles in WordPress code. Finally, he will wrap up with a discussion of some powerful filters that will prove WordPress has a roles and capabilities system that is as flexible as the popular competitors often touted as having superior implementations.

Lastly, here’s the recording:

From URL to Query–WordCamp Miami 2013

Today at WordCamp Miami, I reprised my latest talk, From URL to Query. I’ve now given this talk at WordCamps Phoenix, Atlanta, and Miami; the latter two presentations are an expanded version of the original talk delivered in Phoenix.

Briefly, this was the intent of my talk:

Ever wonder what process WordPress undertakes when someone visits your site? Or how it translates that nice permalink to the database query that ultimately delivers the content your visitors requested? Or what it takes to load the appropriate template from your site’s theme?

In this talk, I’ll walk through WordPress’ loading process and shed some light on the various APIs used. I’ll also discuss how these APIs work together to make the software function.

Slides are available at http://slides.ethitter.com/from-url-to-query/.

I’ll link to the video once it becomes available. The recording of the WordCamp Phoenix iteration is available in the meantime, but isn’t as in-depth as what I covered in Atlanta or Miami.

From URL to Query–WordCamp Atlanta 2013

Today at WordCamp Atlanta, I reprised my latest talk, From URL to Query. This was an expanded version of the content I delivered at WordCamp Phoenix in January. Briefly, this was the intent of my talk:

Ever wonder what process WordPress undertakes when someone visits your site? Or how it translates that nice permalink to the database query that ultimately delivers the content your visitors requested? Or what it takes to load the appropriate template from your site’s theme?

In this talk, I’ll walk through WordPress’ loading process and shed some light on the various APIs used. I’ll also discuss how these APIs work together to make the software function.

Slides are available at http://slides.ethitter.com/from-url-to-query/.

I’ll link to the video once it becomes available. The recording of the WordCamp Phoenix iteration is available in the meantime, but isn’t as in-depth as what I covered in Atlanta.

From URL to Query–WordCamp Phoenix 2013

Today at WordCamp Phoenix, I presented my newest talk, From URL to Query. Briefly, this was the intent of my talk:

Ever wonder what process WordPress undertakes when someone visits your site? Or how it translates that nice permalink to the database query that ultimately delivers the content your visitors requested? Or what it takes to load the appropriate template from your site’s theme?

In this talk, I’ll walk through WordPress’ loading process and shed some light on the various APIs used. I’ll also discuss how these APIs work together to make the software function.

Slides are available at http://slides.ethitter.com/wcphx-from-url-to-query/.

WordCamp Phoenix 2013: WP401

Yesterday, Paul Clark (@pdclark, pdclark.com) and I ran WordCamp Phoenix 2013′s WP401 session. We covered everything from object-oriented plugin development to CSS preprocessors to WordPress’ rewrite system.

The session was recorded, so video should eventually be available on WordPress.tv.

In the meantime, slides for those topics I prepared them for are available:

Thanks to all who attended! It was a great day, due in no small part to the great audience we had. It was a pleasure to work with Paul on this as well!