Category Archives: Plugins

New Beta version of Docs to WordPress

I’m working on a new version of the Docs to WordPress plugin and would love it if a few people could field test it to make sure I didn’t screw anything up. There were mostly a few simple fixes, though I added a new extender that allows you to use a delimiter (by default a |) in your doc to set the headline. The plugin also uses the WordPress HTTP API instead of CURL. Please check it out at

Still to come before the next full version: Image support and (hopefully) a better way to authenticate into Google.

Setting the head of a post using a delimiter in your doc

I’ve gotten a lot of requests from people using our Docs to WordPress plugin on how to set a headline that’s different from the title of your Doc, such as we do at the BDN using a pipe.

This isn’t a standard feature of the plugin, but the plugin does include a few filters to modify how posts are formatted. One of these filters is pre_docs_to_wp_insert, and it can be leveraged as such:

Plugin Name: Extend Docs to WP like so

add_filter( 'pre_docs_to_wp_insert', 'bdn_split_post' );
function bdn_split_post( $post_array = array() ) {

	$exploded_fields = explode( '|', $post_array[ 'post_content' ] );
	//Sometimes people forget a pipe, and we don't want to put the entire post in the headline
	if( is_array( $exploded_fields ) && count( $exploded_fields ) >= 2 ) {

		//Save the old title in case you want to do something with it
		$old_title = $post_array[ 'post_title' ];

		//Set the title to the first occurance.
		$post_array[ 'post_title' ] = strip_tags( $exploded_fields[ 0 ] );
		//Unset the title
		unset( $exploded_fields[ 0 ] );
		//Now restore the post content and save it
		$post_array[ 'post_content' ] = implode( '|', $exploded_fields );

	return $post_array;


I haven’t tested it but the above code should do the trick.

Coming soon: Details on moving stories from WordPress to InDesign!

Update to Google Docs to WordPress plugin

A few weeks ago, unbeknownst to me, Google made a (wise) change to its APIs to require SSL for all API calls. This caused parts (but not all, apparently) of the Docs to WordPress plugin to stop working.

This evening I released an update to that plugin that should resolve any problems people had. In addition, I made a small change to make bold and italics come through more consistently.

As always, you can download the latest version in the WordPress Plugin Repository.

Updated Docs to WordPress plugin: Now with better formatting

Version 0.3-beta of our Docs to WordPress plugin has been released. It’s a fairly minor release, and only affects people using the cleaner extension, but we just rolled it out internally this morning at the BDN and it’s exciting for us, so I wanted to pass it on to the public.

The newest version of the cleaner extension passes correctly parses bold and italic text and headings, such as <h4>. It also strips out span tags to avoid a few instances where they would cause an extra line break.

In an earlier version of Docs, bold and italic text were surrounded by <em> and <strong> tags, as would be expected. It made it very easy to handle stylized text.

In the newest version of Docs, however, text formatting is done completely via CSS. So the header of each of the HTML versions of the Doc contains a stylesheet, where bold and italic text is given an arbitrary class name.

To carry that through to WordPress, I use preg_match to find the correct class name from the stylesheet and then preg_replace to convert span tags to <em> and <strong>. Thanks much to Andrew Nacin, Rob Flaherty Bill, who replied to my cry for help.

As always, the Docs to WordPress plugin can be found in the WordPress Plugin Repository.

New Plugin: Define SSL Pages

Just released: A very simple plugin that allows you to require SSL for certain pages on your site. For example, at the BDN we moved the login form from /wp-login.php to /login/, and wanted to require SSL for that page. So, using this plugin, we can force anyone who visits to

It’s in the WordPress plugin repository:

Quick update to the Docs to WordPress plugin

We’ve released a quick update to the Docs to WordPress plugin that allows the plugin to integrate with WP Cron rather than requiring you to create your own file to run cron against (though you can still do that, too). To take advantage of it, you’ll have to upgrade to the latest version and edit your wp-config file to define at least three variables:

DOCSTOWP_USER: Your Google Docs username

DOCSTOWP_PASS: Your Google Docs password

DOCSTOWP_ORIGIN: The ID of the origin folder you want to draw the docs from

DOCSTOWP_DESTINATION: This one’s optional, but if defined it will put the docs in this folder when everything is finished processing.

To define a variable:

define( 'DOCSTOWP_USER', '' );

To get the ID of the folder, look to the URL. It will look something like this:!–ID STARTS HERE, AFTER THE 0 and the period –!

A quick note: I decided to hardcode the variables in wp-config instead of using a setting because I’d rather store a plaintext password on the server than in the database. Obviously, neither are ideal, so if anybody has a better solution I’m all ears.

Bangor Daily News completes final switch to WordPress

Wednesday, we pointed the last of our traffic to our WordPress servers.

We started planning the transition soon after I started at the BDN in July, and started beta testing the system in late August with our Sports section.

Stories are penned first in Google Docs, then brought over to WordPress via XML-RPC and pushed to InDesign via tagged text. It’s a unique system we built, for the most part, from the ground up, and we believe we’re the largest newspaper running entirely on WordPress.

Over the next few months we’ll be extensively sharing how we did it and open-sourcing much of the project. Our goal is to help other newspapers set up an easy-to-use, low-cost content management system. The setup is actually quite simple and easy to implement.

For the time being, feel free to leave comments with questions or e-mail me at

To get everyone started, I would recommend a few plugins that I think are must-haves for any news org on WordPress. The first, which the BDN commissioned from Mo Jangda, is The Zoninator, which allows you to order content by hand instead of chronologically.

Another is Edit Flow, which is an important tool for managing workflow through WordPress.

Scott Bressler‘s excellent Media Credit allows you to natively set the credit for images, instead of including the information in cutlines.

Co-Authors Plus, also by Mo, allows you to set multiple authors per post.

And CP Redirect is a good example plugin for how you might remap links from your old site. We used it as a template to avoid dropping links.

You might also wish to check out the Ben Franklin Project, from the Journal Register Company, CoPress, which, although not operating anymore, contains a trove of useful tips for converting, and a post I did in 2009 after converting my college newspaper to WordPress.