Posts tagged ‘WordPress’

Three blogs – one low price !

As noted in a prior post, I recently stood up a new blog for my team at work. It quickly became a bit of a bother managing the various plug-ins and themes that I wanted. I thought there should be some way to instantiate multiple Workpress blogs with a single installation of the software.

For really large installations, the proper thing to do is install Wordpress MU. This is the codebase under Wordpress.com and supports hundreds and even thousands of simultaneous blogs. However, it is not for the faint of heart and I only expected to ever host a small number of blogs (three and counting). So I kept digging.

blogs-filmstrip

The This ‘N That blog got me started down a different path. Rubin wrote in his 2006 post about a trick to make the wp-config.php file dynamic. This file is what tells the Wordpress installation where it’s database is. The database tells Wordpress everything else. So, as the theory goes, you point multiple domain names to wp-config.php and inside, write a bit of PHP code to switch between databases. Now, in Rubin’s example, he was trying to overcome the problem of hosting packages that only allow one MySQL database. Bluehost does not have that limitation.  Also, a commenter noted a security whole in Rubin’s original post. So, I made a bunch of changes to my config file so it does not have the security risk and keeps the work blog off in its own database. I did test the notion of having two blogs under one database and using table name prefixes to differentiate. It all worked for a few minutes then I triggered the creation of a new test blog and KAPLUY ! It turns out I had to go into the admin settings for each blog and tell it to refresh its notion of permalinks. I don’t know why I had to do this. I just remember seeing it in the instructions for a plug-in install way back when and it seemed like the best hope for resurrection.

In the end, it all worked. I have the following:

  • one Wordpress installation
  • one set of plug-ins
  • one set of themes
  • each blog has its own domain name and appears as entirely separate entities
  • the work blog has its own database
  • my personal blog and my test blog have their own tables within a common database
  • each blog gets its one directory for storing uploads, images, etc (this was missed in Rubin’s solution)

FYI – The fact that two blogs looks similar has nothing to do with my installation and has everything to do with my current esthetic eye.

In theory, this solution will work for a significant number of blogs. The limitations are your hosting provider’s package of bandwidth and storage. I don’t plan to test the limits of my provider, but I will say, their default package is pretty generous!

A little house cleaning

Some of you got an error today trying to get to the blog, it’s because I was doing some house cleaning to consolidate the work and personal blog designs. I got sidetracked buy work – hate when that happens – so theSalmonFarm was half down for most of the day.

If you look at the work blog at communicat.us and here, you’ll now see common theming.

(BTW: the errors in this post were caused by unexpected limitations with the mail client on the iPhone – who’d have thought!)

Using Wordpress for a "group blog"

communicat.us - the IBM Federal technical team I’ve spent that last few evenings setting up a new blog for a group of colleagues. Unlike theSalmonFarm.org, the new blog – Communicat.us – has a single theme and potentially as many as 20-25 different contributors. After evaluating a number of commercial and open source options, I felt most comfortable with Wordpress since it’s been the platform under this blog for a few years now plus my web hosting provider – bluehost let’s me add a domain and share my current site storage for a nominal fee.

Multiple Wordpress blogs on one website

So, the first thing was to get a second Wordpress installation under the same file system and then point the new domain name to it. I tried editing rules in .htaccess but that made things worse. Thankfully, bluehost support came to my rescue and gave me instructions for setting things up through their cpanel wizards.

Look-and-feel – Theme design

With a clean install of Wordpress, my next task was creating a theme that was three things – business-like, efficient, and visually appealing. It was a tougher than expected but the end result does all three criteria well (and I’ll keep an eye on the performance. The colors were a a constant debate <oye>

Wordpress plug-ins

Next I turned to functionality. I had some things I wanted to bring over from this site. I definitely wanted my jpeg-quality75 plug-in which compresses images uploaded to the blog to minimize bandwidth usage. I definitely wanted the Hashcash plug-in to quietly handle spam without challenging legitimate commenters. Since I needed to enable a number of different ways for the team to contribute, I also added the Postie plug-in for very good blogging by email. (I will confess to have customized some of of the postie code to handle some annoying HTML markup generated by the Lotus Notes client which a number of the contributors are likely to use.) While I was at it, there was one area I wanted to a clean break. On this site, I use "categories" for my tag cloud. It’s not really the right thing to do and now that Wordpress has native tag support, I hid the categories from the theme and installed the wp-cumulus plug-in to generate a FLASH cloud.

Users roles and special features for a group blog

Finally, this new site is a group blog so I am taking full advantage of Wordpress’s user roles, specifically the Admin, Editor, and Author roles. All of the contributors, including myself will be "Authors". Additionally, there are two "Editor" accounts and two "Admin" accounts. I installed the Profile Pic plug-in and inserted the necessary edits to the theme so each post will show the corresponding author’s picture. (BTW: The Profile Pic needs and errata page – the correct PHP to add the author’s pic in a theme is "profilepic_internal_imagetag( get_the_author_meta( ‘ID’ ) )" but otherwise works as documented.)

Testing and  documentation

Once I had the blog setup I did the requisite testing and then I transferred all of the existing content from the old site over. This was a very manual task as the old site did not support any of the standard blog protocols. I also had to document the new blog for all of the prospective bloggers – none of which are bloggers so the documentation has to start from the very beginning with guidelines for "a good blog post" as well as step by step instructions for blogging with the web interface, Windows Live Writer, and using Postie to blog by email.

Everything I’ve described here could be used for any "group blog". You could setup a family blog where the whole family gets to contribute. You could setup a blog for your sports leagues / team captains / etc. A photo club could use this method as could book clubs, and other communities of interest. There really are lots of uses for this setup !

So, that’s explains why I have not been here lately. If you are interested in anything I’ve mentioned above, check out the links provided or post a comment here and I’ll see what I can do.

Improving image compression for Windows Live Writer

zendibs2 I did a bit of PHP coding this weekend (cue screams by programmers and a development managers everywhere). I liked Windows Live Writer the first time I ran it through it’s paces and now I like it even more. There is one serious caveat. The images that WLW creates and uploads are a bit “rich”. What I mean by that is they are bigger than they really need to be.

When I use GIMP and even Postie, I use a JPEG quality setting of 75. This seems to make reasonable small thumbnails for my blogs and even does a good job when the image is 575 px. On average, the 240px thumbnails are between 10kb and 20kb while the larger images are 50kb to 70kb. These sizes make it possible for readers using telephone modems and dial-up service to still have a chance to read the blog without falling asleep waiting for the page to load. I would like the pages to be even smaller but I use images in nearly every post so a typical page size is between 400kb and 500kb.

What I liked about WLW was that it took my basic images and create both a nice thumbnail with drop shadow effect and created all the necessary linking to the full size image. Postie did this too. The difference was I had to add the drop shadow to the big image and exaggerate it so that the thumbnail would have it when Postie scaled it down. Also, Postie make all thumbnails the same size and there was now way to control it on a post-by-post basis.

So, to get the control that I wanted I switched back to WLW but then I needed to find a fix for the larger that desirable image results. This is where that PHP comes in. I have created a crude but effective Wordpress plug-in that detects JPEG files in uploaded posts and re-compresses them automatically. I even gave it a crude name “jpeg-quality75″.

You can download jpeg-quality75 here if you are interested. The install is very simple – unzip then upload jpeg-quality75.php to your Wordpress plug-ins directory and activate it. It has not admin or settings.

The plug-in works by hooking the wp_handle_upload function in Wordpress. This function is called for every file uploaded, the plug-in checks if the file type is a JPEG image and if so, locates the image, opens and re-compresses it using a quality setting of 75, and then stores the result back in the original location, overwriting the original. It leaves PNG and GIF files alone.

I’ll be checking it’s results for a few days but it seems to be doing a good job without corrupting my photos and graphics.

Am I really going back to Windows Live Writer ?

wlr-overview I can not answer the title question – at least not yet. I have decided to give it another try. The reason is that I am finding I want more control over the images incorporated into my blog entries. I have two basic formats for images:

  1. small 240 or 320 px thumbnails aligned to the right side of the post
  2. medium sized 575 px images centered within the post

I have been using the Postie plug-in for Wordpress for processing blog entries authored using Thunderbird or other email clients. I still want to keep Postie as an option for blogging on the road but most of my writing happens in the relative comfort of my office and as such I would like the best tools I can find.

At the same time, I don’t want to use WLW if it will be “stuck” on my machine. I have been assempling a small collectio nof frequent tools into a portable storage device. There is a handy site conveniently called PortableApps.com where I have downloaded and installed Thunderbird, GIMP, and FileZilla. It does not yet have a solution for WLW but TechLifeWeb has packaged up the next best thing. Now, I will give WLW a test run for the next week or two. It won’t help me if/when I build my next Linux PC, but then again, I’m almost happy with my Postie + Thunderbird + GIMP solution so that is always my fall back.