WordPress Snippets at CSS-Tricks

Chris at CSS-Tricks has a huge collection of code snippets for PHP, CSS, jQuery, and, lo and behold, WordPress.

Here’s how you might loop through and display posts in a certain category, for example:

<?php query_posts('cat=5'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>

Custom Post Types vs. Categories

In line with a fundamental keep it simple mentality, I’ve been scouring the web to find best practices on when to use Custom Post Types or when to use Categories. Despite my quest for solid, black-and-white answers, I have found none.

My thought at the moment is to use regular posts and categories as much as you can, and only use Custom Post Types when you really feel need to. Again, no science here, just a gut feeling that you’ll be better off at the end of the day. Take my exhibits, for example: While they seem to be a completely different kind of content, they’re actually just posts of category type “Exhibits.” Easy peasy.

You can read about how to keep posts of this category off the frontpage and out of the regular blog stream here.

Remove certain categories from the frontpage

I’m still not convinced that this is how you want to be doing this, but nevertheless the following will exclude posts of category 11 from showing up on the frontpage:

function exclude_category($query) {
	if ($query->is_home){
	return $query;

add_filter ('pre_get_posts', 'exclude_category');

Paste the code into your theme’s functions.php.

On Macs and PCs, again

After some recent criticism that brought to light the fact that this site was becoming ‘somewhat’ Mac-centric, I decided to be more vigilant about spreading hatred and vitriol in the Windows direction. However, after helping a co-worker with a presentation on a Windows laptop today, I’ve decided that only more hatred and vitriol are required, certainly not less.

In several years of using a Mac I have not seen a single screen look like the one attached. But yet, this was the first screen I saw this morning when I started the laptop. I must argue that (i) it makes absoltuely no sense to show this screen to my Grandmother, my Great Aunts, nor to anyone else, and (ii) there is no way a screen like this one would show up on a Mac.

Despite the abounding negativity from the naysayers about Apple these days, there’s simply no way that a screen like this would be displayed to the user, and certainly you’ll admit that it shouldn’t.


The black magic behind content management

Great insight from Jonathan Kahn on content strategy and how we might go about choosing the right CMS for a project. Spoiler—it's about the content, not the CMS:

The rise of content strategy is dealing the content management industry a huge kick up the backside. In the web’s Wild West era, the CMS was run by the IT department—or sometimes a lone webmaster who knew HTML—so CMS choices were based on features, price, and cultural fit, rather than web or content strategy. It was the classic IT drill: selection committees, feature matrices, and business lunches with men wearing neckties.

Oddly, discussions of content strategy are still had in hushed circles, perhaps in the coffee room or over lunch, or exchanged in secret notes throughout the day. For reasons unknown to me, the real conversations are still being facilitated with feature matrices and neckties. You tell the nice man what kind of website you need and he tells you what he's going to build it with.

Odder still, almost every day I see a company launch a new site with Flash. Yes, that Flash, the bane of the internet. Every time I see a company proudly launch a site with Flash, I cry a single tear for the money and time it's going to cost to update and modify and eventually redo.

As Kahn argues, conversations about content shouldn't be about tools, it should be about content. There are exceptional open source tools out there to help you get your content to the web, all of which you can freely download and play with until you find the right one.

Next time, when the nice man with the tie tells you that he is going to lock your content up in Flash or some other proprietary CMS, tell him 'thanks for your time.' Or get out your wallet.