No Mod Required

WordPress 2.6 is Out. When Will I Find the Time?

WordPress 2.6

I’d like to upgrade. It’s usually very quick, but in fear that it won’t be I like to block out a good section of time to actually do the upgrade. Considering I manage a half dozen or so Wordpress installations (between home and work) that’s actually a reasonable chunk of time to carve out of an already busy day.

The upgrade looks like a good one. I especially like the ability to track changes. We sell Wordpress installation and theming as a cheaper alternative to more expensive CMSs (no licensing fees) and one of the things I always wanted to be able to offer was version control. Now we have it (of sorts?) How robust it is remains to be seen.

I’ll report back once I’ve been able to kick the tires.

Instead of Upgrading the Blog to Wordpress 2.5 I’m Posting Chinese MC Hammer

The weirdest thing about it is that it’s Hammer (yes even weirder than the fact that his mom is knitting in the background.) I’m not even sure this guy was alive when Hammer was doing his thing.

And yeah, Wordpress is upgraded to 2.5. As I mentioned on twitter, it might take five minutes (and the core upgrade will.) The problem is, the “extra” stuff might break and cause me nothing but problems for hours or even days on end. I’m especially curious about the Amazon S3 plugin for WordPress since I post so many images to the site and want to continue to host them @ Amazon S3. Since so much of the admin interface is changed, I fear that will just break.

An Old/New Site I Made is Live

If you’re feeling nerdy, you can check out the long-neglected comic book blog I run. It’s been redesigned and moved into Wordpress, which means I’m more likely to update it than I was when it was on Blogger.

The design is a “knocked out as quick as possible” special. I’ll be tinkering with it over the next few weeks until I’m fully happy with it. I just wanted to get it out there. It’s a full Wordpress site now, which is really the fun part- Valid HTML; a YSLow score in the upper 70s; easier to update; a fancy new sprite; S3 integration for all those cover scans…

What’s not to love?

Click. If you dare!

It’s All Just Comics

Wordpress users…

WordPress 2.3.3 is out.

Since it fixes a security issue there’s no better time than now to upgrade…

WordPress 2.3.3 is an urgent security release. If you have registration enabled a flaw was found in the XML-RPC implementation such that a specially crafted request would allow a user to edit posts of other users on that blog. In addition to fixing this security flaw, 2.3.3 fixes a few minor bugs. If you are interested only in the security fix, download the fixed version of xmlrpc.php and copy it over your existing xmlrpc.php. Otherwise, you can get the entire release here.

Also, there is a vulnerability in the WP-Forum plugin that is being actively exploited right now. If you are using this plugin, please remove it until an update is available from its author.

Since we are talking security, remember to use strong passwords and change them regularly. While you’re updating WP and your plugins, consider refreshing your passwords.

Speaking of Wordpress, does anyone know why Akismet suddenly sucks? The past few days it’s consistently been beaten by trackback spam touting the night vision exploits of a certain hotel heiress. It’s the EXACT same URL, with the EXACT same text and formatting, but it keeps getting through. I’ve had a handful of false negatives over the years I’ve used it (a few a month) and all of a sudden I’ve seen dozens of identical examples in just the past week.

Is someone gaming the system?

Two CSS Techniques I Love + I Rolled My Own Social Bookmarking Component

I used to use AddThis for social bookmarking here on the blog. And by “used to” I mean up until two days ago :-). Over the past couple of days I’ve been working on setting up my own version to use here and throughout the rest of the site. I launched it yesterday.

If you’re on the single version of this post (as opposed to a category index or the blog home page) you should see it in all its simple glory below in the post info box.

Why bother since AddThis does what it’s supposed to do and is dead easy to implement? Well, while the number isn’t really important (only the underlying performance issues it uncovers really matter) it was pointed out recently that I (used to) get a 61 YSlow score for my blog pages (thanks Ben!) One of the contributing factors to that was the use of the AddThis widget which added another domain lookup and several extra HTTP requests for uncompressed files with no expires headers. I looked at all that overhead and inefficiency, looked at the functional complexity (or lack thereof) of the piece and decided I would just roll my own. Beyond the fact that it was just a fun little thing to do, doing my own saved 16 HTTP requests (including 13 Images,) removed a domain lookup and required a total of 0 (zero) extra files to implement. How? I obviously used my existing JS and CSS files and (most importantly) added the icons to my sprite. Those already come along with the page so it’s just an extra 1-2K of image and script on top of my existing site infrastructure.

I didn’t do anything particularly fancy (there’s always time for that later :)), but if you’re curious here’s the basics of the implementation.

Here’s the WordPress code, where we use the_permalink() and the_title() to build out the links:

<div class="shareThis">
Share This :  <a href="http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" class="delicious" title="save to delicious">Del.icio.us</a>
<a href="http://digg.com/submit?phase=2&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" class="digg-this"  title="digg this!"> Digg</a> 
<a href="http://reddit.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" class="reddit"  title="submit to reddit">Reddit</a> 
<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink();  ?>&title=<?php the_title(); ?>" class="stumble"  title="stumble this!">Stumble It</a> 
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();  ?>&t=<?php the_title(); ?>" class="facebook"  title="share on facebook">Facebook</a>
</div>

I chose those five because they were (a) amongst the most popular choices I saw in my AddThis stats and (b), with the exception of Facebook, they have all produced serious traffic spikes here. Facebook has never actually driven a lot of traffic for me, but it was a regular option in AddThis so I included it here.

As for the markup- as you can see, it’s pretty stripped down. All I use are some anchors and a div to hold them. I then use a couple of common (for me) CSS techniques to get that stripped down markup styled up correctly. Here’s the CSS:

.shareThis {
font-size:85%;
font-weight:bold;
color:#666;
background: url(http://media.drunkenfist.com/img/sprite2.png) -315px 0 no-repeat;
/*set position to relative in order to 'catch' child nodes at this level*/
position:relative;
padding:2px;
border:1px solid #ccc;
width:175px;
height:15px;
margin:auto;
margin-top:5px;
}
#moviespg  .shareThis,
#grafpg .shareThis,
#comicspg .shareThis,
#artpg  .shareThis{
/*there's a slightly different context for this widget on the rest of the site*/
font-size:75%;
}
.shareThis a {
/*I love absolutely positioned anchors with display:block*/
/*I use them all the time*/
position:absolute;
width:15px;
height:15px;
/*hide the text*/
/*I might switch this to opacity if the outlines bug me*/
text-indent:-9999px;
top: 2px;
}
/*position the individual anchors on top of their icons*/
/*this is like a new style 'image map'*/
.shareThis a.digg-this {
left:92px;
}
.shareThis a.delicious {
left:110px;
}
.shareThis a.facebook {
left:165px;
}
.shareThis a.reddit {
left:129px;
}
.shareThis a.stumble {
left:147px;
}
.shareThis a:hover {
/*hide the default hover since it obscures the icon*/
background:transparent url() !important;
/*safari didn't like the above, so I threw a little opacity in there*/
opacity:0;
}

I’ll break out two of my favorite techniques in play.

Position:relative with no offset and absolutely positioned child nodes

The key with this technique lies in the behavior of absolutely positioned elements and the way that relatively positioned elements behave when there are no position coordinates (top, left, right, bottom) supplied.

Absolutely positioned elements search for the first parent element with a position other than static to begin to calculate it’s positining. In the above example that’s the containing div. The thing is, the containing div, while set to position:relative, has no offset coordinates supplied to it, which means it behaves exactly as if it were the default, static positioning. In other words it’s still firmly in the normal flow of the document.

In the situation above the benefits of that might not be all that evident, but imagine this layout:

so-easy.png

With the middle content div set to position:relative and the two sidebars set to position: absolute inside of it, that layout can be achieved with a minimum of fuss. The header, content and footer DIVs are just in the normal flow. They will expand and contract as needed and won’t need any special handling to grow as long as might be needed by the site content or any conditional messaging. The content DIV is set with enough internal padding set to accommodate the sidebars and the sidebars, as long as they don’t need to control the height of the document, can be placed with pixel perfection wherever they need to go. No need to mess with floated content or anything fussy like that. Just two nice and stable absolutely positioned elements mixed with a normal block item document flow that would have worked in 1999. That layout will produce very few surprises.

Of course, if the layout requires two or more of the columns to be able to control the height then this technique is invalid, but if it’s as simple as the one above, go nuts.

Another place I use that technique is with headers or mastheads. Headers often have three elements- a logo, a main menu and a utility menu. With that layout I will use a relatively positioned div for the container and then place three absolutely positioned items inside for the three elements: an image replaced header (h1, h2) for the logo, and two unordered lists for the two menus. The markup might look something like this:


<div id="header">
   <h1><a href="/" title="return to the home page">Our Company Name</a></h1>
   <ul id="main-menu">
      <li>menu item</li>
      <li>menu item</li>
      <li>menu item</li>
   </ul>
   <ul id="utility-menu">
      <li>menu item</li>
      <li>menu item</li>
     <li>menu item</li>
   </ul>
</div> 

And would render something like this:

common-header.jpg

So straightforward and it allows me to move things around with perfect precision.

Modern “Image Maps”

This ties in with the above but focuses entirely on using anchors as absolutely positioned block level elements to create “hot spots” in much the same manner old school image maps do. In the High Performance Web Sites book, Steve Souders talks about talk about using image maps to reduce HTTP Requests. While from a performance perspective that’s a valid approach, image maps as a whole are out of favor and are rarely (if ever) a technique I’ll look to use.

The following is a somewhat more accessible, SEO friendly method of achieving the same result.

A note about the example above, before I point out one that’s a little more along the lines of my normal usage of this technique.

While I definitely like to use unordered lists as a container for menus and the like, there are plenty of situations where there’s really no need for a containing framework. While in this example you could make an argument that I should have a list around the links (it’s a list of links after all,) my first concern with this component was to create something really stripped down code-wise. I was trying to improve performance after all, so I went with the least code possible, sacrificing some potential semantic meaning in the process.

If I weren’t flexible about these things I’d have to quit my day job and go work for a standards body :)

Anyway, the following image and code sample will outline a really useful implementation of this technique.

Here’s some HTML:

<div class="messaging">
     <h2>The Toughest Challenges, The Most Interesting Ideas</h2>
     <a href="/register-now">register now</a>
</div>

Here’s some CSS:

#copy .messaging h2 {
text-indent: -9999px;
height: 211px;
width: 778px;
position:relative;
}

#copy .messaging a {
position: absolute;
display:block;
text-indent:-9999px;
left: 200px;
top:150px;
height:28px;
width:140px;
}

And this is what it all looks like:

anchor-highlighted.jpg

As you can see with the red highlight, the absolutely positioned anchor perfectly fits on top of the hot spot, just like an old school image map; except in this case the meaning of the link is clearer in a text browser or to a search engine spider than it would be just using an image maps alt attribute.

Cool stuff.

To me at least…

I might actually turn this into a WordPress plugin, by the way. I’m like 25% of the way there already. Not that we actually need another one of these things of course. I’d do it just for the pure enjoyment of creating a nice solid piece of code that can be used around the internet. If I do, I’ll document the whole process here :)

Layout update

Just a quick layout update here. The look is changed*, but more important to me are the adjustments I made to the source code itself and to the source order.

With the source order, I moved the sidebar that used to be over to the left way down in the source order- it used to sit at the very top of the source order. Now the first stuff that spiders (and users with screen readers) see is pure content. Those of you with the web developer toolbar can turn off styles to see the naked goodness of the site now. It’ll be interesting to see if the change enhances my search engine placement at all. Of course, I know the site is now a better, cleaner, experience for people browsing with screen readers and with text browsers, so that’s a bonus whatever Google thinks about my changes.

*honestly, this has been a to-do list item for something like six months. When I moved over to Wordpress as part of the site relaunch I didn’t put as much effort as I could have into the theme. As time went on and I started to really enjoy posting on the blog again, the shortcuts I’d made with the layout and with the blog markup started to drive me a little batty. Thankfully I was able to steal some time tonight to start in on getting this section straightened out.

More to come as the days go by :)

Another New Site I Made Is Live- Innocentive.com

It’s true.

Make with the clicking:

Innocentive

If you’re asking, “Who?”

From their About Us page:

“Founded in 2001, InnoCentive connects companies, academic institutions, and non-profit organizations, all hungry for breakthrough innovation, with a global network of more than 125,000 of the world’s brightest minds on the world’s first Open Innovation Marketplace™.”

I did HTML, CSS, some JavaScript and a Wordpress theme/configuration for their PR/News section. I think the site looks pretty good, personally :)

It’s like they’re updating the whole Internet.

WordPress 2.1 has dropped. I’ve downloaded it already and will be playing around with it a little bit over the next couple of days. I’m interested in seeing all the Ajax-y goodness that they promise. I’ve already poked at the the comments enhancements a little bit- they’re pretty cool.

I also want to see if (a)the plugin I built will work with the new version (it looks like it does at first pass) and (b) if there are any new developer tweaks that would have made it easier to put together (more on that as I poke around.)

For work, I like this option:

“You can set any “page” to be the front page of your site, and put the latest posts somewhere else, making it much easier to use WordPress as a content management system.”

Why? The more I can work in Wordpress at work, the happier I am there. When I working with Java or .Net developers I feel like such a good since I’m always asking for help doing what I assume should be basic stuff. Working on a good old LAMP system like Wordpress I can go off in a corner and make the whole thing hum on my own. Which is crazy cool.

I’m not sure when I’ll upgrade this blog to the new version, but from what I can see so far (granted, it’s only been twenty minutes) it looks like it’ll be worth my time.

[updated to add]: The DB script actually updated this installation as well as the one referenced in my sandbox installation (the two WP installs are in separate tables in the same database with different prefixes.) Why it would do that is beyond me (the M in lamp is my weakest link.) Askimet is a little flukey this morning and several elements of this, the “write post” page have changed since last night. Everything is working, which is a good sign, but it’s annoying to feel like I’m being forced into upgrading to the new version.

On the other side of the spectrum, Google homepage added a preview button to some of the feeds that they offer. Check it out:

google-homepage.gif

I think that’s cool.