WordPress as a CMS: Table of Contents

Making it a bit easier to find the articles.

I decided to put together a quick table of contents for my 7-part series about using WordPress as a CMS. This should make it a bit easier for readers to find and read the related articles in the order in which they were written.

Heres the list:

I refer to this series in quite a few other pieces here.

How to Advertise Special Offers with your WordPress Blog

A surprisingly simple solution.

If you operate a blog-based Web site — or even a Web site that includes a separate blog — there’s a good chance that you can use the built-in category and RSS feed features to distribute special offers to site visitors by e-mail.

I set this up on my WordPress-based Flying M Air Web site the other day and it works like a charm. Let me explain how.

The Goal

Before I explain how to set this up, let me take a few moments to explain why you might want to do it. The best way to do that is to explain what my goal was.

Flying M Air offers helicopter tours, charters, and excursions throughout Arizona. Some of our flights begin and end in Phoenix, which is about 1/2 hour from our base in Wickenburg. The folks who buy Phoenix-based tours and charters cover the cost of our flight to the starting point, but with a penalty to our profit margin.

My idea was to “piggyback” other tours out of Phoenix on existing tours. So, for example, if I knew I had a flight at 1 PM, I could offer similar flights out of Phoenix in 12 noon and 2 pm time slots. These piggybacked tours would be offered at a discount to encourage customers to sign up. This would enable me to serve multiple Phoenix-based customers with one round-trip to the Phoenix area, thus maximizing my revenue for the trip.

What I wanted to do to get the word out was to publish the special offers on the Web site and automatically e-mail these offers to potential customers who were interested in receiving offers. I’m not talking about spam here. I’m talking about a mailing list that people voluntarily subscribe to and could unsubscribe from at any time. Something I wouldn’t have to manually manage. (God knows I have enough work to do.)

How I Did It

Flying M Air's siteI started by creating a “Be Spontaneous!” category on my Flying M Air site. The purpose of the category is to publicize “last-minute” special offers for specific dates and time slots. Because not everyone would know what “Be Spontaneous!” means, I also added a link to the category on the top navigation bar, with a more obvious label: “Special Offers.”

I then created post-dated entries with the special offers I wanted to advertise. Only one offer would appear at a time. I’d have to manually delete the offers after the date (or perhaps leave them there so visitors could see the kinds of offers they missed).

Next, I went to FeedBurner and set up a feed for the special offers. While there, I set up the E-mail Notification feature. You can learn how to do that in my Informit.com article, “Add Email Notification to Your Blog with FeedBurner.”

Finally, I added a subscription form to the sidebar of the site. I also got fancy and added an introduction to the Be Spontaneous! category that explained what it was all about and offered a subscription link.

Mission accomplished. (Really, though.)

Give It a Try

This is how I did this with WordPress, but you can just as easily do it with other blogging software. (Just don’t ask me which ones or how to do it. I’m a WordPress user.) The key ingredients are the separate special offers category and the FeedBurner e-mail subscription feature.

One word of advice: if you’re going to go through the bother of doing this, make sure your special offers really ARE special. Don’t turn this into spam. Not only will you annoy and alienate your subscribers, but you’ll give them the idea that subscribing to Web content always leads to spam.

And that’ll ruin it for the rest of us.

WordPress as a CMS, Part 7

Creating a Title-less Home Page

If you’re just tuning in, this is the seventh installment of my series of articles about using WordPress as a CMS to build an informational Web site. Throughout this series, I’m talking about a specific site I developed: Flying M Air, a helicopter tour and charter company I operate when I’m not writing and tweaking my Web sites.

I decided early on that I wanted my site to have a static home page that provided basic information about my company. Visitors could then use the links along the top of the page to view more information in other static pages or the links in the right column to learn more about specific tours and other services.

The Andreas theme I’d modified included page links along the top of the page. As I mentioned in Part 3 of this series, I created the pages and used the Page Order option to assign numbers to the pages that would determine their order. The theme automatically listed the pages by name as a row of buttons at the bottom of the header, using the following code:

<?php wp_list_pages('sort_column=menu_order&title_li='); ?>

Remember, the CSS code in style.css is what determines the appearance of the links on the site.

I created a home page, gave it a title of Home, and assigned a Page Order value of 0. That put it at the beginning of the list, right where a Home page button should appear. My Home page included random images (covered in Part 5 of this series) and text with links.

Now I needed to make that page be the page that appeared automatically when someone went to the default page of the root directory — in other words, www.flyingmair.com. I used the Static Front Page plugin by Denis de Barnardy. Miraz covered this plugin in our WordPress book, so I don’t want to go into a lot of detail about it here. I simply installed and activated the plugin, then confirmed that the Post Slug for the Home page was home. My Home page was the static Home page.

This may have satisfied a lot of people, but not me. The problem was, the page title (Home) appeared at the top of the Home page. I didn’t want it to appear at all. So I had one more thing to do.

Like all other Pages on a WordPress-based site, my Home page was displayed with the page.php file. I opened the file and inserted some conditional code (shown in bold type) around the instruction to display the title near the beginning of The Loop:

<strong><?php if (is_home()) { ?><?php } else { ?></strong><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> <?php edit_post_link('<img src="'.get_bloginfo(template_directory).'/images/pencil.png" alt="Edit Link" />','<span class="editlink">','</span>'); ?></h2><strong><?php } ?></strong>

Here’s how it works.

  • <?php if (is_home()) { ?> says that if this is the home Page, display what comes next. But that’s followed immediately by <?php } else { ?>, so nothing is displayed.
  • <?php } else { ?> says that if this is any other Page, display what comes next. That’s the title as a H2 heading and link, as well as the icon I’m using for displaying an Edit link.
  • <?php } ?> says to stop acting on the is_home conditional statement; the rest of the content should appear for all Pages.

The result: for any Page except the Home Page, the Page title appears at the top of the page.

I think that just about covers all of the special features I included in Flying M Air’s new WordPress-based Web site. Did I leave something out? Use the Comments link if you think there’s another topic I could cover in this series. Otherwise, I’ll call it quits for now.

But don’t worry; there are plenty of other WordPress-related tips and topics I can share. Keep checking in for more.

And now, can I interest anyone in a helicopter tour?

WordPress as a CMS, Part 6

Adding Print and E-Mail Features

If you’re just tuning in, this is the sixth installment of my series of articles about using WordPress as a CMS to build an informational Web site. Throughout this series, I’m talking about a specific site I developed: Flying M Air, a helicopter tour and charter company I operate when I’m not writing and tweaking my Web sites.

Because Flying M Air’s Web site was designed to be a sort of “online brochure” for my company’s services, I wanted the site’s visitors to be able to print information right from the site’s pages. Unfortunately, printing a WordPress blog page doesn’t seem to come out as pretty as it does on the site. Try it for yourself and see.

Although I could create PDF brochures for every tour and charter, it would be a royal pain in the you-know-what to recreate these documents every time I had a price change. To make matters worse, there was no way to force visitors to download the nicely formatted brochures instead of simply using their browser’s Print command to print what they saw in the browser window.

Clearly, I needed a better solution.

As usual, a plugin already existed to do the job: WP-Print by GaMerZ (AKA, Lester Chan). This plugin enables you to include a Print link or icon within The Loop for each post. When a user clicks the link or icon, the plugin generates a printer friendly page.

WP-Print is pretty easy to use. Just drop the plugin’s print folder into your plugins folder, go into the Plugins Management Administration Panel, and activate the WP-Print plugin.

Print OptionsNext, configure the plugin in the Print Options administration panel (Options > Print). You use the drop-down lists to indicate whether you want the user to be able to print comments, links, and/or images. I turned off images because they looked ugly with the yellow border around them. Click Update Options. You’re almost done.

Open the template file that includes The Loop and insert the following code where you want the Print link to appear:

<?php if(function_exists('wp_print')) { print_link(); } ?>

If you prefer a print icon like I have, no problem. Use this code instead:

<?php if(function_exists('wp_print')) { print_link_image(); } ?>

A word here about the Print icon that comes with WP-Print. It assumes you have a white background. I don’t. So I had to create my own little print icon. (I did the same for the e-mail icon, which I discuss later.) If you have to go this route, make it roughly the same size and give it the same name as the Print icon that comes with WP-Print and stick it in plugins/print/images/ to replace the existing icon.

If your theme uses The Loop in more than one place, you need to insert this code wherever you want the Print link or button to appear. For example, in my theme (Andreas), I had to insert it in index.php, archive.php, and single.php. I could have stuck it in page.php, too, but I didn’t need to, for reasons I’ll discuss in another installment of this series. In my aneclecticmind.com site, which uses the Exquisite theme, I just had to stick it in the post.php file, which is called by all other files that need to display posts. A much nicer solution, if you ask me.

While I was adding plugins and code, I figured I may as well add an e-mail feature. GaMerZ has one of those, too: WP-Email. This plugin enables you to put an E-mail link or button in The Loop for each post. Clicking the link or button displays a form the visitor can use to e-mail the post’s contents to someone else — or himself.

As you might expect, the plugin installs the same way. Put the email folder in the plugins folder and activate the plugin in the Plugin Management administration panel.

Configure the plugin in the E-Mail Options window (E-mail > E-Mail Options). I won’t show them here because they’re too big to display on this page, but they’re pretty self-explanitory. You can get more information in the documentation. Just make sure you select PHP for the Method Used To Send E-Mail if you’re not using an SMTP server.

Of course, when I installed it, I skipped the configuration step, which caused me to do a whole bunch of other work…more on that in a moment.

Now open the template file that includes The Loop and insert the following code where you want the E-mail link to appear:

<?php if(function_exists('wp-email')) { e-mail_link(); } ?>

If you prefer a e-mail icon like I have, no problem. Use this code instead:

<?php if(function_exists('wp-email')) { email_link_image(); } ?>

Remember, I modified the e-mail icon so it would have that silly yellow background that appears on my site.

E-Mail FormNow here’s where I screwed up — and only because I didn’t follow the instructions. I went onto the site and clicked the E-mail button for a post. A form like the one shown here appeared. The only problem was, there was no image in the Image Verification area. Why? Because the version of PHP I was using didn’t support captcha.

If I’d followed the instructions, I would have seen that that feature could be disabled. But I didn’t see the configuration options at all. So I did things the hard way. I upgraded PHP. And let me tell you, it was a scary thing to do. I actually lost all my blogs for about 10 minutes. Then I figured out how to get them back and everything is working fine. As an added bonus, I can now use the captcha feature in Spam Karma, which has cut my comment moderation work down to zilch.

Of course, I soon realized that I could only send one message every few minutes, which made testing tough. I found the configuration options and after slapping myself on the side of the head, adjusted the settings to give the new feature a good testing.

The moral of this story is RTFM — read the FABULOUS manual. (Gotta keep this site PG rated.)

While I’m discussing The Loop (kind of), I want to mention that I disabled the display of comments (and even comments links) in the Loop. I did this by commenting out the php comments_popup_link tag. I could have deleted it, but I was worried that I might need it someday and not be able to enter it back correctly. I already disabled comments and trackbacks in all posts and pages by setting defaults (as we discuss in our WordPress book).

Why did I do this? Remember, this blog is being used as a CMS. Although I could have left posts open for comments, I didn’t want to deal with Comment spam or have site visitors ask questions using the Comments feature. Visitors on the site are able to contact me using a contact form — that’s something we cover in our book so I won’t be discussing it in detail in this series.

In the next installment of this series, I’ll tell you about the site’s static Home page and the trick I used to get it to appear without a heading. Tune in next week!

WordPress as a CMS, Part 5

Adding random images.

If you’re just tuning in, this is the fifth installment of my series of articles about using WordPress as a CMS to build an informational Web site. Throughout this series, I’m talking about a specific site I developed: Flying M Air, a helicopter tour and charter company I operate when I’m not writing and tweaking my Web sites.

I didn’t expect my site to have a lot of pages, but I did have a lot of pictures I wanted to show. One of the things I learned long ago is that every Web page needs a good mix of text and images. Not too much of either one. But rather than pick and choose a limited number of photos to illustrate my aircraft and destinations, I decided to use a more complex solution: set up the site so images would appear randomly on the pages in predetermined places.

I searched for a plugin that would help me do the job. The first one I found was the Random Image Plugin. This plugin randomly selects an image attached to a post using WordPress’s built-in upload feature and displays that image. This is not what I wanted to do.

I then found the Random File plugin by Scott Reilly. This plugin enables you to place a random file from within a specific folder in a theme’s template file or, with the help of a plugin like Exec-PHP, within a post or page itself. That’s exactly what I wanted to do.

I created the images in two basic sizes: small, for the left sidebar, and medium, for within posts and pages. The small images already existed in a predefined size in my old Web site on its sidebar. All I had to do was modify them to use them in the new site.

Come Fly with Me!The modifications weren’t difficult, but required some use of Photoshop. Since my brochure used a snapshot-like image format, with a white photo border and drop shadow, presented on a 3° angle (in either direction) I wanted the same format on my site. The angle and drop shadow required that the entire image be placed on a background the same color as my site’s page background: yellow. You can see an example here.

I created a few Photoshop actions that automated the lengthy process of resizing the image (for medium images), placing them on a background, creating the drop shadow, and tilting the whole thing one way or the other. I did this with all the images I wanted to use and saved them as JPEGs in topical folders on my Web server, within an images folder in the wp-content folder. For example, one folder had images of the helicopter in flight, another had the interior, another had destinations for day trips. You get the idea.

I installed and activated the plugin. It’s very straightforward, with only one file to upload to the server and no configuration required.

I also installed and activated the Exec-PHP plugin. We discuss this plugin in our WordPress book, so I won’t go into detail about it here.

Now I was ready to add the random images. For each page of content, I decided where I wanted the image to go and what kind of image I wanted to display. For example, on the Home Page I wanted to display a photo of the helicopter in flight. I had a folder with a few of those images in there, so all I had to do was insert the code that would display a random image from that folder:

<img src="<?php echo c2c_random_file('/wp-content/images/helicopterinflight/'); ?>" class="right" alt="Flying M Air's Helicopter in Flight" />

Keep in mind that I put this code in the body of the Page — not in the template file used to display the page. That’s why I needed Exec-PHP. You can’t include PHP in a post or Page without something like Exec-PHP to help out. (There are other plugins that do the same thing, but this happens to be the one I chose. With luck a reader of this article will point out some alternatives.)

Note the class="right" component of the tag. This uses CSS to position the image. For this to work, you must have right defined in your style.css file. This was predefined in the version of Andreas I used to base my site on, so I was all set. Otherwise, I could have done it the old fashioned way, with code like class="right" align="right" hspace="5". But the CSS approach is better, as Miraz could explain better than I could.

I did this throughout the Pages and posts on my site, wherever I wanted a random image. If I wanted the same image to appear every time in a specific spot, I just used a plain old img link to specify the image I wanted to appear.

Getting the smaller images in the sidebar was a bit tricker, but the Random Image plugin’s excellent documentation gave me the information I needed. The goal was to display a bunch of random images. If I just used the same code several times in a row, there was a chance that an image would be repeated in the column. I didn’t want that. So I used this code in the leftsidebar.php file:

<p><?php
$files = array();
for ($i=1;$i<=<strong>7</strong>;$i++) {
   $file = c2c_random_file('<strong>/wp-content/themes/andreas/images/small/</strong>', 'jpg png gif', 'url', $files);
   echo '<img src="' . $file . '" alt="Random image #' . $i . '" />';
   $files[] = $file;
}
?></p>

There are two configuration options to note here:

  • The number 7 in the code is the number of images to display. I keep playing with this number, so it might show a different number of images if you visit the site. My goal was to have the column of images approximately the same length as the navigation sidebar so they’d balance out the page.
  • The path to the folder of images to display tells Random Image where to find the images. In this case, I put the images in a folder in the theme folder. But I could have put them anywhere, including in the images folder with my other images.

To make this work in the sidebar, it’s important that all the images are the same size. Otherwise it’ll look weird. Of course, you might want it to look weird. I didn’t.

In the next installment of this series, I’ll tell you about the Print and E-mail features I added to help site visitors share information with others. See you next week!

WordPress as a CMS, Part 4

Adding category-specific post links to the sidebar.

If you’re just tuning in, this is the fourth installment of my series of articles about using WordPress as a CMS to build an informational Web site. Throughout this series, I’m talking about a specific site I developed: Flying M Air, a helicopter tour and charter company I operate when I’m not writing and tweaking my Web sites.

Before I begin this installment, I want to take a moment to remind readers that although the topics I’m covering in this series are for Intermediate to Advanced WordPress users, WordPress 2: Visual QuickStart Guide, which I co-authored with Miraz Jordan, is for Beginning to Intermediate users. The book uses an extremely structured step-by-step approach, with lots of referenced screenshots to guide readers through the completion of hundreds of tasks. This article series uses a more conversational narrative tone and assumes that readers already know the basics.

My point? Don’t shy away from the book if the articles in this series have been too difficult for you to follow. The book will likely provide you with the basic information you need to get started with WordPress and move on to the next step. After working with WordPress (and hopefully, the book) for a while, you’ll be ready to articles like the ones in this series.

One of the drawbacks of using a blog format for sharing information that isn’t necessarily date-specific is that entries are presented in reverse chronological order. To get around that, I had to tweak the dates of the posts so the ones I wanted to appear at the bottom of a category page would have earlier dates than the ones at the top.

The other related problem is that not everyone likes to scroll down a page to see all of its contents. So, for example, if I had six tours in my Wickenburg Tours category, there was a good chance that a site visitor would never scroll down the page to see them all.

To resolve this potential problem, I decided that I wanted a list of all tours to appear near the top of the sidebar. But only the tours for the category currently being viewed. So while viewing the Wickenburg Tours category, I wanted just the entries for that category’s tours to be listed.

To do this, I had to insert some conditional statements into the sidebar.php template file. Here’s an example:

<?php if ( is_category('2') ) : ?>
<li>
<h2>All Wickenburg Tours</h2>
<ul>
<?php
$posts = get_posts('numberposts=10&category=2&orderby=post_title&order=ASC');
foreach($posts as $post) :
?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endif ; ?>

What this basically says is that if WordPress is displaying the Category 2 page, it should display a heading of “All Wickenburg Tours” followed by an unordered list of up to 10 post titles (with links) for category 2 in alphabetical order.

(Keep in mind that this code includes a lot of extra tags required by my theme for formatting lists in the sidebar; these tags must be stripped out or modified for other themes.)

I then created the same bit of code for each category that listed my tours and inserted it into the sidebar.php file, right after the search form.

I went a step further with this, however. I also wanted the appropriate list of posts to appear if a visitor was looking at a post on its own (single) page. So I copied and pasted all the conditional code to the area right above it, changed all the is_category tags in the copy to in_category tags, and inserted <?php if ( is_single() ) : ?> before the first conditional tag and <?php endif ; ?> after the last one. That set up the tags so they’d be executed properly on a single page, too.

The best way to see what I’m talking about is to just visit the site and experiment with its category and post links.

In the next installment of this series, I’ll explain how I got the images to automatically change in the left sidebar and on many of the pages.

WordPress as a CMS, Part 3

Planning the site’s organization and creating the Pages.

The primary difference between an informational Web site and a blog is that a Web site’s content stays pretty much the same from day to day while a blog’s content changes regularly when new posts are added. That’s one of the reasons that blog entries display the date and have date archives. This kind of functionality wasn’t what I needed for the new Flying M Air Web site.

WordPress, of course, offers the static Page feature which makes it possible to create content that exists outside the blog’s chronology. Unfortunately, pages don’t make use of the Category feature, which is another way that blog entries are organized.

Let me take a moment to explain the kind of information I needed to convey to site visitors and how I wanted to organize it.

  • First, I had a bunch of very static, unlikely to change information, such as the company background, contact information, and information about the helicopter. Although this could be presented using blog entries with a “General Information” category, I wanted to present it separately, using the page feature.
  • I also had descriptions for the tours, day trips, excursions, and other services I offer. I wanted to group these together by category, which seemed like a logical organization for me. Now although I could create a separate page for each description as a subpage under a parent page, I thought that approach would be difficult to manage. So I decided to use blog entries for each description, assigning one or more categories as necessary.

The theme I had chosen and modified (a version of Andreas, as I discussed in Part 2 of this series) had a very nice horizontal navigation bar at the bottom of the header, perfect for WordPress Pages. But I worried that site visitors might be confused by two separate and apparently unrelated navigation bars: the nice horizontal one on top and the vertical one in the right sidebar, which included the list of categories. If I didn’t include information about my services in the top navigation bar, site visitors might not find it. So I decided to create summary Pages that listed and described several categories of tours and services, providing category links for each one.

Here’s how it works. On the top navigation bar, there’s a Tours & Day Trips link. Clicking that link displays a WordPress Page that discusses three categories of services: Tours, Short Day Trips, and Arizona Day Trips. Clicking one of the “Learn More” links on that page displays the category with its tours.

With this approach, a visitor could find my services, no matter which navigation method he used.

Once I decided on an approach, it was time to create the pages. I created eight pages: Tours & Day Trips, Excursions, Charters & Other Services, Get Brochures, Q & A, About Us, About Our Helicopter, and Contact us.

Although I didn’t create the pages in that order, I wanted them to appear in that order. So I used the Page Order field in the Write Page administration panel to assign a page number to each page. I skipped numbers when numbering them so I could easily change the order by changing just one Page’s Page Order value.

The Get Brochures Page currently provides links to downloadable PDF files. I didn’t use the link feature or any special template for the Page — although I could have. It didn’t seem worth the extra effort. But now I’m thinking that might be a good idea so the downloadable links appear on every page. So if you look at the site and that Page is missing, check the sidebar for the Brochure links; I’ll probably move them there.

The Contact Us page provides contact information for Flying M Air as well as an e-mail contact form. The contact form was created with the WP-ContactForm plugin by Ryan Duff. Miraz discusses this plugin in Chapter 7 of our WordPress book, so I won’t go into detail about it here.

In the next installment of this series, I’ll tell you about the conditional statements I used in the sidebar to list all tours for the currently viewed category.

WordPress as a CMS, Part 2

Finding and modifying just the right theme.

One of the things I hated about the old version of Flying M Air’s Web site was its boring design. I can say that — I designed it. Lots of people complemented me on it, but I think it’s because they had low standards and didn’t expect much of a Web site. It was a good site because it was simple, was written almost entirely in HTML, and it used few images so it loaded very quickly — even for those folks who are still accessing the ‘Net with a dialup connection.

Old Flying M Air SiteThe site’s gone now — I don’t want people Googling up old pages — but here’s a thumbnail to show how it looked. I can briefly describe it. Basically, it had my company name and logo in the header. Then there were three columns: two narrow ones on the right and left and a wider one in the middle. The column on the left displayed images of the helicopter in flight or on the ground or views out the helicopter window. The column on the right displayed company news, promotions, and other information. The column on the right was only there on the Home page; it didn’t appear on any other page. The wide column was for content. Navigation was with a series of links, in two rows, at the bottom of the header. When you pointed to a link, it changed color and an underlined appeared beneath it. That was the extent of my visual effects. Even the color scheme was boring — black and red on a white background — because, as I frequently tell people, I couldn’t design my way out of a paper bag.

Flying M Air's New BrochureRecently, as I reported in my blog, I asked a designer to help me come up with a design for a tri-fold brochure. The front panel of the resulting brochure is what you see here.

To me (a nondesigner), the brochure was incredible. I couldn’t believe that my little company could have such professional looking marketing material. I learned a valuable lesson: it really does pay to hire a professional.

But I also started thinking that if brochure readers went to the Web site, they’d see this sad, obviously home-grown site. They’d realize that Flying M Air wasn’t a huge operation with a fleet of helicopters, stable of pilots, and unlimited marketing budget. My cover would be blown.

I didn’t want that to happen. So before the brochures went out, I’d have to redesign the site. And since I’ve been using WordPress for all my new work, I decided to try it out for Flying M Air.

There were elements of the brochure I wanted to include in my new site:

  • The three colors: blue for header, red for footer, yellow for content. If I could get the line curves in there, great!
  • The framed photos with drop shadows.

There were also elements of my old site that I wanted to incorporate in the new one:

  • The small images of the helicopter and views down the left narrow column.
  • My company logo.
  • Calendar of upcoming events.
  • Photos…and lots of them.

There were also elements that I didn’t currently have on my site that I wanted:

  • Horizontal navigation of summary pages in the header with something more spiffy than plain old HTML links.
  • A search form. Yes, it’s true. My old site wasn’t internally searchable.
  • Contact form. I didn’t want my e-mail address anywhere on the site.
  • Site statistics (beyond a simple counter).
  • The ability to e-mail content from the site.
  • The abilty to print specific content from the site.

In my mind, I came up with a 3-column format: two narrow columns on the left and ride side of the page and a wider column in the middle. (Sound familiar?) I’d put the small pictures on the left and use the right column for navigation, searching, calendar, and whatever else I needed to display. The format also needed to have a well-defined header and footer.

With this in mind, I began my theme search. Keep in mind that although I might be able to figure out how to create my own theme from scratch, I don’t have 20 years to get this job done. I — like most smart WordPress users — prefer to start with an existing theme and customize it for my own use.

A while back, Miraz shared a tip on our book’s Companion Web site for a new WordPress Theme Viewer. I surfed on over there and gave it a try. It enables you to search for a theme based on criteria including the number of columns, colors, fixed vs. variable width, etc. I searched for a 3-column, fixed-width layout. Among the search results was the theme I chose: a version of Andreas ported by Matteo Turchetto. The version I downloaded appears to be gone, but this version is very similar. You can go to the author’s Andreas page to see all variations of this theme.

I had to make a bunch of changes to the style.css file to fit my needs, some obvious, others not so obvious. Here are some examples:

  • Modify the background-color attribute for the body, container, header, and footer elements so they would match the header, footer, and body (container) of my brochure. I also wanted to change the page (body) background to white so the black text would appear on it as the page loaded.
  • Modify the color of the h1, h2, h3, and various link elements to match my brochure’s color scheme.
  • Modify the font-size of various elements. I wanted body text and sidebar links to be legible and headings to be toned down a bit.

You get the idea.

I should probably take a moment to explain how I modify my CSS file. I open it with TextWrangler, a Mac OS text editing application that enables me to open and modify text files via FTP. I make a change, save it, and immediately refresh the page that is affected. If the change screws things up, I undo it, save it, and double-check to make sure the problem is gone.

Other people use a more conservative approach, especially when working on blogs that are “live” and being accessed by sitge visitors. In that approach, you modify a copy of the CSS file and upload it back to the site, being sure to maintain an untouched copy in case the revised copy makes a mess of things. This is a good technique if you have a good working knowledge of CSS.

Unfortunately, that’s not me, so I need to use the trial and error approach.

With the colors in place, I attacked the content. The original theme had two sidebars, each of which included links. I didn’t want links in the left sidebar, so I modified the leftsidebar.php file to remove everything between the opening <div> tags. I would replace them with the small images I’d had on my old site, after fixing them up a bit. I’ll discuss all that in a later installment of this series.

Then I went into sidebar.php and removed all the content there that I didn’t want, which left just the search form and the categories list. The categories list used the list_cats tag, which I don’t like very much — I prefer wp_list_cats because it’s easier to configure and read. I wound up replacing that whole section with the following very simple code:

<li>
  <h2><?php _e('About Our Services'); ?></h2>
  <ul>
  <li><?php wp_list_cats('hide_empty=0') ?></li>
  </ul>
</li>

Of course, at this point, the blog didn’t have any database content other than the “Hello World” post, its comment, the uncategorized category, and the usual collection of blogroll links. I went to the administration panels for the blog and got to work.

I changed the Uncategorized category’s name to What’s New. Then I added the categories my site would need in the order I wanted them to appear. Because the wp_list_cats tag was set to show all categories — even those without posts — the categories automatically appeared in the right sidebar in the order I created them in.

I didn’t touch the links; since I wasn’t using any tags that would display them, it didn’t matter what they were. I may delete them in the future if I decide to offer links to other sites.

At this point, I had a good shell for my site’s content. I’d do that next.

But just one more appearance thing, first. My brochure has curved borders for the blue header and red footer. I wanted the same effect on my site. So I created a pair of images — one for the header and one for the footer. The header image was basically the blue curving border on a yellow background. The footer was the red curving border on a yellow background. I inserted the img tag for each image in the appropriate template file, header.php or footer.php so that the images would appear at the end of the header and the beginning of the footer. I had to fiddle around a bit with margin and padding settings in the style.css file to get it just right. I’m pleased with the results.

In the next installment of this series, I’ll cover planning the site’s content and creating the Pages.

WordPress as a CMS, Part 1

I discover that WordPress makes an excellent content management system.

CMS. I’ve seen the acronym quite a bit lately. Sadly I had to ask Miraz what it meant. (Blast my “swiss cheese” knowledge!) For those of you who are too shy to ask someone, it stands for content management system. It refers — at least as far as WordPress is concerned — to a system for publishing content on the Web.

I maintain a bunch of Web sites, most of which were originally created with Dreamweaver using HTML. Basic, boring stuff. Not very polished because of my limited knowledge of CSS and higher-level Web publishing languages and tools. And Dreamweaver was cumbersome to work with, especially on my 12-inch PowerBook’s little screen. (Dreamweaver, like so many software programs these days, is best to work with if you have a lot of screen real estate.) I wanted another solution, one that would make modifying pages and adding new content easier.

The answer, as I’ve discussed elsewhere in my blog, was a blogging tool. I got a false start with a blogging client called iBlog, then discovered and settled down with WordPress. I immediately converted two of my most content-heavy sites to WordPress format: wickenburg-az.com and aneclecticmind.com (which also now includes my blog and langerbooks.com in support of my book).

But was WordPress a true content management tool? Something I could use for a plain old Web site? Something that didn’t get new content a few times a week? Something that required easy-to-navigate pages so customers (preferably the hiring and paying kind) could find the information they needed? Something that could be formatted with my company’s “branding”, matching the appearance of existing brochures and advertisements? Something that would make them want the service I was selling?

I got the answer to that question this week. And the answer was yes.

Feast your eyes on the recently redesigned and republished Web site for Flying M Air, my helicopter tour and charter company. I think it makes a fine example of a WordPress CMS-executed Web site.

Although the site looks simple, there’s a lot that went into it. Over the next few weeks, I’ll be publishing articles here that explain the challenges I faced in building the site and the solutions I came up with. I’ll provide lots of source code for you programming types, as well as tips and tricks for people who don’t like to roll their sleeves up quite as high.

Whether you’re using WordPress for a blog or a plain old Web site, I think you’ll find something of interest in the upcoming articles. So keep checking in. I’ll write them as I find time and you can find them here.