author image
Earth Hour 1.3 Released
Feb 17 2010 • Written By Duane Storey • 5 Comments

In preparation for this year’s upcoming Earth Hour event, we are pleased to announce the release of a new version of our Earth Hour WordPress plugin.

Earth Hour Screenshot

Earth Hour Screenshot

The features in this version include:

  • Ready for 2010!
  • Brand new admin panel with options
  • Updated Earth Hour page design (now dark- uses less screen energy!)
  • Updated banner design
  • Added option to set custom page text
  • Added option to choose image, set custom image
  • Added option to preview Earth hour page
  • Updated code, css, js etc
  • Tested in IE 6+, Firefox 2+, Safari 3+, Opera 9+
  • Updated POT file for new translations

Last year we had approximately 1,000 sites participate in Earth Hour using our plugin, and we’re hoping even more people show their solidarity this year. For more information, visit the Earth Hour plugin page.

If you’re fluent in another language and would like to translate Earth Hour, please translate the associated POT file (included in the plugin download), and send us the .PO file via our contact page.

author image
Block External Suckage Of Your Images, Prying Eyes
May 6 2008 • Written By Dale Mugford • 1 Comment

Holy server resources and bandwidth suckage Batman! Seriously- hot-linking to your images and media files from search engines and other sites can be a good thing- but also a very bad thing, depending on what it is that being hot-linked and whether or not you want there to be external linking to your file(s).

In the best case scenario, it drives traffic to your site and helps advertise for you, freely. In the worst case scenario you piss off your webhost and in turn have outages.
(more…)

author image
How To Show Content For Specific Users In WordPress Templates
May 2 2008 • Written By Dale Mugford • 17 Comments

One thing about building WordPress templates I haven’t seen a lot of documentation on is user-specific content. There are a few plugins out there that help with adjusting and assigning roles and capabilities, and there’s a good wiki document on the WordPress Codex site for defining the roles and capabilities that exist in WordPress, but not a lot about how to craft up some template codes to produce content for specific users.

Let’s say you have a little box on your sidebar you use to greet your subscribers (registered users), and also want to use it as a control box for your editors, authors, and contributors, while also as the administrator, have your own custom content there.

The first thing we’ll do is find out what levels our roles are at. On a default WordPress install of 2.5, the roles and the max. role number hierarchy are as follows:

Administrator: level 10
Editor: Level 7
Author: Level 4
Contributor: Level 2
Subscriber: Level 0
*all role levels also contain the capabilities of those below them

Now, there’s a little bit of a mess with regard to all the various capabilities assigned to each role, so if you want the long play version of what this is all about, visit the codex for the nitty gritty.

So now, we know the number assigned to each role, but how do we identify who’s using the site and serve up dynamic content for them? WordPress knows who you are when you’re logged in, so we just have to ask it to show different content when it identifies users’ roles.

It’s a good thing we can do this easily too, and we can add some DIVs around it, inside it, and style up our box any way we see fit.

To start, let’s create dynamic content showing for an administrator and subscriber, and something that will show by default to those not logged in:

<?php
if (current_user_can('level_10')) : ?>
<?php print "control the world"; ?>
<?php elseif (current_user_can('level_0')) : ?>
<?php print "read and comment only"; ?>
<?php else : ?>
<?php print "you gotta log-in to see the goodies"; ?>
<?php endif; ?>

With this code if an admin is logged in and viewing the page, “control the world” will be shown. If a subscriber is logged in, “read and comment only” will be shown to them instead. For users not logged in or registered, “you gotta log-in to see the goodies” will be shown.

Let’s go further, and add the other roles:

<?php
if (current_user_can('level_10')) : ?>
<?php print "control the world"; ?>
<?php elseif (current_user_can('level_7')) : ?>
<?php print "edit, write, publish, delete, read, comment"; ?>
<?php elseif (current_user_can('level_4')) : ?>
<?php print "write, publish, delete, read, comment"; ?>
<?php elseif (current_user_can('level_2')) : ?>
<?php print "write, read, comment"; ?>
<?php elseif (current_user_can('level_0')) : ?>
<?php print "read and comment"; ?>
<?php else : ?>
<?php print "you gotta log-in to see the goodies"; ?>
<?php endif; ?>

Of course you can go to town here, and have entire loops, pages, and posts setup to be displayed dynamically to different roles when users are logged in. This method provides an excellent way to serve premium content on your WordPress site, dynamically. Of course a plugin like WP-Cache won’t work too well in this case because the dynamic content would get eaten up by the cache system.

There is a workaround there, though. With WP-Cache, you can force the cache to go and get another php file and include it outside of the cache:

<!--mclude users.php-->
<?php include_once(ABSPATH . '' . get_bloginfo('template_directory') . '/users.php'); ?>
<!--/mclude-->

In the above case, we put our dynamically-served role content into a separate php file called ‘users.php’, and dropped that in our active themes’ directory. Then we put this code where we originally had it showing up before we activated WP-Cache. Abacadabra Batman: it’ll now stay dynamic.

Also, if you just want to show different content based on whether a user is logged in or not, you can use this template tag anywhere you like:

<?php if (is_user_logged_in()){ ... } ?>

An example where different content is displayed:

<?php if (is_user_logged_in()){
echo "Welcome, registered user!";
}
else {
echo "Welcome, visitor!";
};
?>

author image
Title Tags And WordPress
Mar 6 2008 • Written By Duane Storey • Comments Off

I’ve spent a great deal of time in the last few months trying to understand how search engines work, and how sites get indexed. In a previous article, I recommended that the XML Sitemap generator for WordPress should be installed on sites to help with search engine crawling. On this site, Google has gone from around 400 indexed articles (about 20%) up to around 1600 articles (about 80%) for my website — a substantial increase, entirely due to the sitemap.

I want to write briefly about WordPress title tags in the context of search engine optimization. Most default WordPress blogs are configured to output the blog name first, followed by the article title (for example, reading an entry called “Things to do in Vancouver” on the blog MyBlog would have a title that looked like “MyBlog – Things To Do In Vancouver.”

There are several problems with that approach. First, every entry that makes it into Google is going to end up with “MyBlog” as the first part of all descriptions. If that’s you, go to Google and type “site:myblog.com” substituting your blog name. Notice how all the descriptions look almost exactly the same? Plus, if you have a large title, Google is going to truncate the useful part of descripition, leaving rather useless search results for your website.

A far better approach is to reorder the title tags around so that the blog description comes first. If you’re up for editing your theme, you can try changing your title block to the following:


<?php if (is_home()) { ?>
<?php bloginfo('name'); ?> » <?php bloginfo('description'); ?>
<?php } else { ?>
<?php wp_title(); ?> » <php bloginfo('name'); ?>
<?php } ?>

This not only improves the appearance of your titles in Google and other search engines, but usually improves your search ranking as well (since Google weights the beginning of the title higher than the end).

Another problem with WordPress is that your post title is the part that usually ends up in the title of the post. That’s fine and dandy if you always make clear, descriptive titles for all your posts. But not only is that often hard, it doesn’t lead to very artistic or snappy titles.

Thankfully there’s the SEO Title Tag Plugin that you can download that will change the behaviour. Once it’s installed you’ll get an extra option in your WP-Admin panel where you can specify the actual html title element you want used for the post, decoupling it completely from the title the user sees in the blog entry. You’ll have to make a small change in your theme header to get that title to appear in the title tag, but it’s not very difficult.

author image
Digg Categories In Need Of A Serious Overhaul
Feb 6 2008 • Written By Duane Storey • Comments Off

I love Digg. I surf it at least a couple times a day, usually when I’m bored, sitting a work waiting for something to compile. I would say that without a doubt the majority of my “cool” news actually comes from Digg.

Lately I’ve begun submitting the odd story on my own to Digg. No matter how many times I try to submit something though, I always seem to get stuck on the same old problem — what category does the story fit in? The main problem I think is that Digg categories are more mainstream news oriented and less about the things I actually am interested in (even though I think most techies are interested in the same things I am).


Digg
Image from here

The main technology categories are:

  • Apple – this seems straight forward
  • Design – what the fuck does this mean?
  • Gadgets – I can live with that
  • Hardware – Isn’t that sort of a gadget? Or is it more computer oriented?
  • Industry News – What is considered technology industry news? That’s pretty open.
  • Linux – straightforward, all things Linux
  • Microsoft – spam folder?
  • Mods – for the engineer in all of us
  • Programming – shouldn’t we split web from non-web development?
  • Security – Security of what? Your house? Your files?
  • Software – this is pretty open ended too

Now, that list isn’t completely horrible at first glance, but let’s try and categorize a few standard things. Let’s take a few of my interests, and some of the things I write about from time to time – Photography, Blogging, Social Networks, Internet Search. Where do these fit in?

You could fit Photography in the Arts section I guess, but that’s a fairly big umbrella. Most of photography these days is digital, so why not have a section on Digital Photography. I see tons of Digg articles all the time talking about HDR imagery, iPhoto, Aperture, etc., so why not have a section where these can end up in. Right now, these don’t really end up anywhere important on Digg.

Blogging? Nope, there’s no real category for that. If you’re talking about the technical side of blogging, it could fit into Programming. In terms of add-ons for blogs, cool new CMS platforms or things of that nature, nothing really fits. Another big miss for Digg.

Social Networks? These are the ones I find strange. I’ve dugg a few articles on Facebook, and I have no idea where they should go. Considering all these networks are valued in the billions and most of us spend a good portion of our day on these sites, shouldn’t they get a special section? Another strike.

Internet Search? Yahoo, Google, search, SEO, web 2.0 — these are all popular things to talk about on the Internet, but they don’t really have a proper home in the Digg category system. Why not have a “Internet” or “Web Technologies” category to put some of these?

I think the makers of Digg just choose a few random categories after a few beers one time and didn’t actually stop to consider how useful they actually were. Another popular article today on digg describes how there are less and less technology stories these day. I’d wager it’s partly because nobody knows where the heck to put them.

I think the guys at Digg need to sit down and rethink some of these. If you have any suggestions, drop a line below.

Note: There is a poll embedded within this post, please visit the site to participate in this post’s poll.