Stop climate change by optimizing your website
Climate change has no regional boundaries and threatens more than the environment. If we continue on this path, famine, flooding, war, and millions of refugees are the likely outcome. Given the urgency of the issue and the upcoming international climate negotiations in Copenhagen later this year, it’s only natural that this years’ topic for Blog Action Day, is climate change.
All throughout the day, you’ll no doubt be reading on the many actions you can take to help stop climate change. But did you know that if you are using WordPress, you could be making minor adjustments that also help? Making your website “green” is as easy as reducing the number of of calls to your database. Let me show you how.
WordPress is a database driven website. All of your content, posts and page information resides in a database and every time someone visits your site, a call (SQL query) is made. Reducing the number of calls will not only green your website, it will also speed it up.
Obvious ways to reduce the number of calls are by:
- optimizing your images and make them as small as possible
- displaying a few posts on your page instead of hundreds
- cleaning up your css and reducing the file size
- minimizing the use of plugins
Something that may not be as obvious is to remove calls to the database located in your template files.
For example the header.php template is usually made up of the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php if (is_home()) : ?><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?> <?php else : ?><?php wp_title('', 'false'); ?> - <?php bloginfo('name'); ?> <?php endif; ?></title> <!-- leave this for stats please --> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /><?php wp_head(); ?> <style type="text/css" media="screen"> <!-- @import url( <?php bloginfo('stylesheet_url'); ?> ); --> </style> </head> <body> <div id="wrap"> <div id="header"> <div id="logo"><a href="<?php bloginfo('siteurl'); ?>"><span><?php bloginfo('name'); ?></span></a></div></div>
You can eliminate 5 calls to the database simply by replacing the meta http-equiv tag with:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
the feed with:
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.yourUrl.com/feed/" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="http://www.yourUrl.com/feed/atom/" />
the pingback link with:
<link rel="pingback" href="http://www.yourUrl.com/blog/xmlrpc.php" />
and the style sheet link with:
<!-- @import url( http://www.yourWebsiteThemeDirectory/style.css ); -->
It’s not much, but any reduction in energy use is better than nothing.