CMS Face Off: WordPress

April 2016

CMS Face Off: WordPress

The first competitor to the CMS Face Off is finally complete! It took longer than expected but I'll put that down to personal motivation and having to make initial decisions. I knew I wanted at least two post types:

  • It's easy to make the second type events but then I'd have to come up with events.
  • It's easy to make the events holidays but I need to keep modifying the date so I have upcoming events.
  • It's easy to change the date with a cron job but many holidays move around.
  • Do I find some funky script or free api that will tell me the date of next Easter?

In the end I stuck with holidays that are consistently on the same date. I've got other things to do, you know.

So anyway, I started the CMS Face Off with WordPress. I've been working with it for years and in that time it's gone through some nice advancements. For example, when I started with wp it didn't have menus. You had to use the order page attribute. Back then wp was really only for blogs. I worked on a few sites where they'd have one cms for the site and then wp for the blog.

So anyway, here's a bit of a break down:

Security Plugins

I don't understand why stupid people need to do stupid things and try and break the site I just made with WordPress. I think one of wp's biggest drawbacks is hackers and spam comments. Seriously, I don't get it.

Since I've been working with wp for so long, I've come to depend on a few plugins that are just about mandatory for reducing this garbage. Notice I said "reducing". Same way plugins keep getting made to fill security gaps, jerks dig for new security holes.

iThemes Security (formerly Better WP Security) - This plugin is amazing! It does everything from common sense protection (like suggesting you change the admin username to not "admin") to advanced scheduled database backups, monitoring changes to files, and blocking ip addresses that have too many login fails. I think I like changing the login url the most.

For this demo site I've also installed plugins to disable rss feeds and disable comments. While I'm ok announcing to the world "here, look at this wp site" I don't want to be flooded with emails about spam and blocked ips.

Helpful Plugins

I use these plugins almost all the time.

Advanced Custom Fields - When WordPress was just for blogging, you only needed the title and content fields. Want to be fancy and have a specific excerpt instead of using the first 150 characters of the post? Here's a field for that.

There's always been a way to add custom fields but in early days (and I think still now) you had to manually type in the field name. Try explaining to clients that to give the post an external link they have to give a value to "news_external_link". Someone will eventually do it wrong.

The ACF plugin is a slick, drag and drop way to add fields to almost anything: posts, pages, categories, custom post types (see below). And there are many field types to choose from.

Contact Form 7 - Everyone wants a contact form. Collect info from users and mail it to someone. This is my go to. It includes field validation and submits via ajax.

Custom Post Type UI - Posts are good and generic but sometimes a site needs multiple entry types. In creating a custom theme you can add code to functions.php to create a custom post type but then I always feel like the client is tied to that theme. Activate a different theme and you don't even see the additional post types in the wp backend menu.

This plugin let's you create post types and specific taxonomy. Then go to town with ACF (above) to make the post type exactly how you want.

Plugins for this Project

I haven't used Widget CSS Classes or WP User Avatar before but they were good for what I needed.

Custom Code

I only half thought through the events/holiday calendar before I started. Always a mistake. It was easy enough to use Custom Post Type UI plugin to make my Holiday post type and I knew I could just toss wp loop code in sidebar.php but I like to think of what the client may wnat in the future. Sure, right now the upcoming holidays is in the side bar but maybe in future it'll be moved to the footer. So I made a custom widget.

Then I remembered I wanted a page with a full calendar.

  • I started looking at existing event plugins but most created their own post type. I didn't want to recreate each holiday post.
  • Calendars for existing posts were for published posts. My holiday posts are set with future dates (scheduled) so they look like they're upcoming.

Instead of trolling through hundreds of plugins to see what would do close enough to what I wanted I made my own plugin. The most difficult part was googling for php code to output the calendar (so, not difficult at all).

The Weird Thing

Actually, the *most* difficult part of the calendar was figuring out why I'd get the 404 page when I was trying to get to a calendar month that wasn't in the current year. Turns out one of the params I was using was a wp reserved term. So even though it was trying to load a page, the param ?year=2015 made wp try to load the page (by slug) that was published in 2015.

Overall

I like the end result. As usual I'm not 100% sure what all the wp code does (xmlrpc.php?) and I don't necessarily like the contact form code on pages without a form but it is what it is. WordPress is generally a good experience (when you're not taking over someone else's code) and I like dragging and dropping images as new media.