Ozh’s Who Sees Ads Plugin for WordPress

WordPressOnce upon a time, back in the heady days before the collapse of the Internet bubble, I was making close to $1,000 from ads on various websites/blogs I was running.  Not bad considering it was (and still is) just a hobby. Today most months I make enough money to pay the dedicated server costs, so basically the blogs subsidize some of the other things I do with the web server.

Anyway, like everyone else I’m not a big fan of seeing ads everywhere on websites I visit and I try to limit how intrusive ads are on this and other sites I run. One way I’ve done that is with the Ozh Who Sees Ads plugin for WordPress.

As the name suggests, the plugin gives you a lot of control on which visitors to a WordPress site see ads. I’ve got it set up so both visitors who are logged in and visitors who are regular readers (2 visits in the last 10 days) should never see ads (and really, you should be using Firefox with AdBlock Plus anyway, but that’s a different rant).

The plugin has a lot of flexibility, so you not only could I not show ads to logged-in and regular visitors, but I could show additional ads to folks who don’t meet those criteria, etc.

WordPress Plugin to Regenerate Thumbnails

The other day I realized I had accidentally set thumbnail generation in WordPress to be exactly 150×150 even when that wasn’t a proportional resizing of the larger graphic. Ugh. I reset the pref to the proportional setting, but what to do about the existing thumbnails?

Well, this is WordPress so you have to use a plugin for everything, and it turned out there’s a nice Regenerate Thumbnails plugin that will let you resize all thumbnails after changing the preferences. Worked like a charm for me.

Customizing WordPress Tag Pages with Conditionals and AnyVar

WordPressI’ve been looking for a way to customize the text shown on Tag pages. For some Tag pages, I’d like to include additional information related to the topic. For example, on the World of Warcraft tag page I might want to include information about my toons and links to the WoW Armory.

The official WordPress documentation, which is in general subpar, suggests creating a tag-[tag].php template for each tag you want to customize. So for my WoW example, I’d create a tag-world-of-warcraft.php template and include the custom changes there. And then do that for potentially hundreds of tags. And then edit each of those templates anytime something changes. No thanks.

A better solution is to use conditionals in the tag template in conjunction with a text substitution plugin such as AnyVar.

AnyVar lets you create text substitutions that can be placed anywhere within a site. For example, for my World of Warcraft example, I can compose a couple paragraphs about WoW and assign in to world-of-warcraft-var. Then, in the template, I just surround it in brackets like this: [world-of-warcraft-var], and AnyVar will handle inserting my text there. Anytime I want to update that text, I simply go in to AnyVar, change the text there, and it gets updated instantly.

Then it’s just a matter of inserting something like this into the tag.php template:

<?php /* If this is the World of Warcraft tag archive */ if( is_tag(world-of-warcraft)) { ?>
[world-of-warcraft-var]
<?php /* If this is a tag archive */ } elseif (is_tag()) { ?>
<h1><?php single_tag_title(); ?></h1>

Obviously you’ll need a separate if(is_tag(tag-name)) conditional for each tag that is going to have any customized content.

It’d be nice if there was a plugin that would do this automatically, but this is fairly straightforward and a lot easier than littering a site with dozens of different tag templates.

Keeping a WordPress Site Private

WordPressBoth of my children known my wife and I have blogs, and they’ve wanted their own sites to post their artwork and pictures and write about the things that are important to them. So I went ahead and created a couple subdomains and installed WordPress. But since they’re still young, I wanted to password protect the entire site so only logged in users can view their blogs — that way I can give a guest username/password to family members who might be interested, while locking everyone else out.

The bizarre thing is that WordPress does not support this out of the box. If you want to do this with WordPress, you’re going to have to install a plugin. And — lucky me — all of the plugins that do this are broken because WordPress changed how it handles authentication cookies in 2.5. I ended up downloading Angusman’s Authenticated WordPress Plugin, then modified the code to take into account WP’s new preferred authenticaton method, but it was a pain.

What makes this particular feature a bit odd by its absence is that Automattic does offer folks who sign up for a blog at WordPress.Com the option to hide their blog, so its not like this is a feature (like caching) where the devs are just idiots and think nobody wants that.

Given how simple the code to make a site private is, it is silly that this capability isn’t already integrated into WordPress.

WordPress Problem In Search of a Solution

WordPressSo awhile ago, I converted all of my WordPress Categories into Tags, and overall I’m much happier managing 1,000+ tags than 1,000+ categories (which is really because WordPress’ category implementation sucks, but anyways…)

So I have a lot of tag pages where I’d like to insert some different arbitrary text. So, for example, on the World of Warcraft tag page I’d like to insert some info about my toon and link to the WoW Armory section, etc.

One way to do this is to create a new tag.php template for each tag and insert the text there. So, for example, I could copy my normal tag page to tag-world-of-warcraft.php and then insert the tag there. Like I really want to do that for the 200-300 where I’d like to add some text.

And, as far as I can tell, there isn’t any other way to do it. Ideally, it would be nice to have some sort of custom database field that would allow a tag_description-style field, and then php code that could be placed in the tag template that would check to see if a tag_description exists for the given tag and then insert if if it does.

Anyone know of a plugin that can do something like that or some way to do this?