How to set a publication time in WordPress

Last night I was chatting to a colleague who mentioned the difficulty of having to Publish a post in WordPress before a related event had actually finished. His post should really appear after the event, not during, or before.
As I drove home I wondered why he was having this problem — after all you can easily schedule a post to be published on any date and time you choose. Then I thought that perhaps he, and you readers, might not know this was possible, or how to do it.
Here are two methods for scheduling a WordPress post — through the web interface and with MarsEdit.
Use the web interface
Log in and set about writing your post. If you don’t know how to do this step yet then learn about that first. I know a good book that can help: WordPress 2 Visual Quickstart Guide.
Before you click the Publish button look on the right-hand side of the window and click the plus sign at the right end of the Post Timestamp heading. Some options appear that allow you to set a publication time and date.
Change these to suit your post, then make sure to check the box beside Edit timestamp. When you eventually Publish your post it will display that timestamp (if your theme uses timestamps). More importantly though, if you set the timestamp for a future time or date, the post will not be visible to the public until then.
If you’re logged in you can still view the post as a completed work:
- While editing the post, check the browser’s address bar. When I wrote this item my trial post had this address:
http://miraz.info/wp-admin/post.php?action=edit&post=11. So, the post id is 11. - To view the post I visit my training blog at
http://miraz.info/. After that URL I add:?p=11, like this:http://miraz.info/?p=11.
Use MarsEdit
MarsEdit is a fabulous off-line blog post editor. Posting exclusively through the web interface is a mug’s game. I only do it when I add images to a post so I can use WordPress’s thumbnail creation facility.
- Write your post in MarsEdit and then click in the
bodyarea of the post. - Choose Edit Date… from the Post menu. A window appears where you can adjust the time and date.
- Set the time and date to suit your post, then click OK. When you Publish your post, those settings will be used.
I wonder if anyone really thinks I post all my MacTips at 5 am?
WordPress 2.3 Beta I Now Available

WordPress 2.3 Beta I is now available for testing. From the announcement post:
Some of the features of 2.3 include plugin and core update notification, built-in tags support, faster javascript, and SEO-friendly URL redirection….However all of the new functionality is still very rough, so only test the beta if you are comfortable troubleshooting PHP issues, filing tickets, and backing up your data religiously.
While cutting edge is nice, bleeding edge is not for me. I’ll wait until the final release. But if you’re the kind of person who likes to work with software still under development, go at it!
Web Site Redesign: Fitting in My Photos

One of the reasons I chose the Cutline 3 Column Right theme for my site’s redesign is because I wanted a three column layout that was wider than my old site. Studies — including stats from all of the sites/blogs I operate — showed that the vast majority of Web site visitors have their screen resolutions set to 1024×768 or wider. I even use that setting on my little 12″ PowerBook. So the old site’s redesign was throwing away 200+ pixels of screen real estate that could be better used providing content or navigation features.
How Do I Use Those Images?
The problem I faced was the header image. Since I built my blog in WordPress nearly two years ago, I had been displaying images that I’d taken during my travels. The images had to be cropped and fit into pre-established format. I used the Random Header plugin to randomize the display. Over 18 months, I’d added nearly 100 images to the header image collection. I’d even begun writing about them in the About the Photos topic. They had become an integral part of my site and I didn’t want to lose them.
So while I continued working on my Leopard book during the day, this little problem was in the back of my mind. For days. One option was to rework the CSS and change the header image so it only took up a portion of the width and use the space beside it for a Web site description. Unfortunately, I don’t know enough CSS to do this successfully without spending hours on trial and error. With a deadline approaching, I couldn’t afford to waste time experimenting. I had to have an answer and be ready to implement it.
About the Photos Images
Then I remembered the smaller images I use in About the Photos to show the images I’m discussing. What if I put three of them side by side and displayed them with some sort of randomizer? Would they fit? What would they look like?
The images in question were 324 pixels wide. The space I had to work with was 970 pixels. 3 x 324 = 972. My luck, sometimes.
I reduced the size of three images to 322 wide and began some quick experiments to replace the existing header image (the street scene you see in the screenshot above) with the three images. I could get them to fit and they didn’t look bad. But I couldn’t get the spacing between them just righ. And I didn’t like the way they fit right up against each other.
A Short Film History Lesson
Then I came up with the film sprocket idea.
For those of you who began using a camera in the digital age and aren’t familiar with 35mm film, let me explain. Before everyone started using digital cameras, serious photographers used 35mm film. The film comes on rolls and has tiny holes along each side. A camera has gears that line up with the holes. You feed the film into the camera and it grabs the holes with its gears. A mechanical lever pulls the next blank piece of film from the film canister to the place in front of the shutter for the next photo. When the roll was finished, the photographer (or his camera) would roll the film back into the canister and the photographer would drop it off for processing. When he picked it up, he’d get prints and negatives. The negatives are the actual film, with inverse (or negative) images on them.
If a photographer had his own darkroom, he’d likely make a contact sheet. This was created by putting the negatives right against a sheet of photographic paper in the dark, then exposing the paper to light for a short time and developing it. The resulting images were tiny (at least they were from 35mm film) and clearly displayed rows of black boxes on either side of the image with black lines between them — like you see here in the header of my redesigned site.
So anyone who has worked with film should recognize these little holes. Of course, my images are considerably larger and wider, so they’re not exact representations of contact strip images. They’re just borrowing the idea.
When I modified the three images to include the borders and fake sprocket holes, I liked what I saw. I created a Photoshop action to modify the 89 remaining images so they were smaller and included the tiny black boxes and borders.
Randomizing
On my old site, the random header image was randomized with a WordPress plugin named Random Header. But since I had three images to show in my header, I needed a different solution. So I turned to the software I used on Flying M Air’s Web site to randomize some of the images there: Random File.
Random File enables you to display random files anywhere on a template. (If you use a plugin like Exec-PHP, you can even display them within posts.) What’s neat about it is that you can tell it how many random files — well, in my case, images — to display and it will display that quantity without repeating them.
After some fiddling around with the CSS used in header.php — remember, I’m no expert — I added the following code in place of the existing header image code:
<?php
$files = array();
for ($i=1;$i<=3;$i++) {
$file = c2c_random_file('/wp-content/<em>foldername</em>/<em>foldername</em>/', 'jpg png gif', 'url', $files);
echo '<img src="' . $file . '" alt="Random image #' . $i . '" />';
$files[] = $file;
}
?>
The result is what you see here.
The Hard Part Was Done
With the tough design decision done, I was ready to put the new theme into place. I did that on Saturday, taking most of the day to get it 90% functional. I’m pleased with the results.
Comments? Questions? Use the Comments link or form below.
WordPress image thumbnail size

I often add images to my WordPress posts — not so much here, but in the MacTips archive and on my Oddity59 personal blog. From time to time I wonder just how big the image thumbnails are, and occasionally I even ponder how to go about changing that thumbnail size. Dagon Design has the answer.
Change Default Thumbnail Size in WordPress:
One question I get asked quite often is how to change the default size of the thumbnails that WordPress creates when you upload an image. It is actually quite easy to change — it just requires modification of one WordPress file. When WordPress 2.1 was released, it changed the way this was done, so I have included instructions below for both WordPress 2.2/2.1 and pre-2.1.
[Mentioned on the Wise Women mailing list.]
Web Tools: Color Wizard

I am not color blind. I know I’m not. I see colors and I know when certain colors look good together. But I can’t, for the life of me, come up with a color scheme on my own.
Color, of course, is a major part of any Web site’s look and feel. So when I found a blog post months ago that listed a few online color tools, I bookmarked them for later use. On Saturday, one of them came in very handy as I decided on a color scheme for my blog’s new look.
The Color Wizard is a Flash application by Donald Johansson. This excellent online tool helps you find colors that work well together.
From the Color Wizard page:
The color wizard lets you submit your own base color, and it automatically returns matching colors for the one you selected.
It returns a set of hue, saturation and tint/shade variations of your color, as well as suggests color schemets to you, based on your color’s complementary color, split complementary colors, analogous colors and other variations. The color wizard also has a randomize function that lets you generate color schemes you might not have thought of on your own.
It’s the randomizer that helped me. I just kept clicking the Randomize button until I found a few schemes I liked. When I had about eight of them, I went back and reviewed each one, eliminating the ones I liked less until I had one I liked a lot. I then picked the blue color from the theme and generated another scheme from that, so I could get the colors I planned to use for my links.
What was also handy for me was the print feature. Although it’s not obvious on the application, if you right-click the Flash app, a Print option appears in the shortcut menu. I used that to print my two color schemes on my color printer. So not only can I visualize what the colors look like — or at least approximately what they look like; I don’t have a great color printer — but I have a document that clearly lists all the hex codes for all the colors.
I’m so pleased with the results that I clicked the Donate link at the bottom of the Color Wizard and used my PayPal account to send the developer some lunch money. (As usual, I urge everyone who uses great free software like this to thank the developer with a donation or at least a visit to his advertiser’s sites.)
Looking for a color scheme? The Color Wizard is a great place to start.
Fixing Post By E-Mail In WordPress 2.2

I finally upgraded my personal blog to the latest version of WordPress, which is version 2.2.2 (as I write this). In addition to breaking a handful of my plugins — not a big deal, since I was able to replace just about all of them with newer, better versions — it also broke WordPress’s post by e-mail feature, which we discuss on pages 64-66 of our WordPress book.
The Post by E-Mail Feature and How It Broke
If you’re not familiar with this feature, you might want to be. It’s pretty cool. It enables you to send an e-mail message to a special account you set up for WordPress to check. When WordPress finds a message there, it automatically posts the content of the message to your blog, using a predefined category that you choose. The message subject becomes the post title.
In WordPress 2.2, WordPress simply stopped seeing and importing the body of the message. As a result, you’d wind up with properly titled but otherwise empty post.
The Fix
Some research on WordPress.org uncovered a post which explained the problem and offered patch code for the class-pop3.php file. This file, which resides in the wp-includes folder of a WordPress server installation, is responsible for processing posts by e-mail.
I manually replaced the bad code with the new code in my file and tested the results. It worked fine.
Rather than fiddling around with code like I did, you can simply download the revised file here. UnZip it and use it to replace your current class-pop3.php file. (If you’re smart, you’ll save a copy of your current file — perhaps by renaming it right in the folder in which it resides — before replacing it.)
This file definitely works on my WordPress 2.2.2 setup. It might not work with earlier or later versions of WordPress or on your setup if it has been heavily modified, so try it at your own risk.
A Neat Trick
While I was researching the problem, I picked up a neat trick in the WordPress Codex.
If you use post by e-mail, you probably know that your e-mail messages won’t be posted unless WordPress checks for mail. As we wrote in our book (on page 66), there are at least two ways to do this: manually by opening a specific Web browser page or automatically using a plugin.
But there is another way to automate the process and it’s pretty easy for WordPress novices who aren’t afraid to roll up their sleeves and modify a template file. Simply include the following code in your theme’s footer.php file:
<iframe src="http://<em>yourblogdomain</em>/<em>wordpressinstalldir</em>/wp-mail.php" name="mailiframe" width="0" height="0" frameborder="0" scrolling="no" title=""></iframe>
This forces WordPress to check for mail every time someone loads any page on your site.
The drawback to this is that if your site is very busy, your server will be checking pretty often for e-mail messages. But it seems to me that you could include the same code on another template page that’s used less often, perhaps category.php (if present) or archive.php or page.php.
Hopefully, you’ll find this information useful. As usual, comments are welcome. Use the Comments link or form below to share your thoughts with me and other visitors.