What’s wrong with commercial WordPress Themes: WooThemes vs ElegantThemes

Monday, March 28th, 2011

As a web development company, we build a lot of sites. Many of the sites are true custom development jobs, starting from TwentyTen or Cutline for the base template files. That's the right way to build a site, as you'll quickly see.

But often our clients can't afford custom development. So we bought developer licenses to WooThemes.com and ElegantThemes.com and thought we were set. While Woo are as a group not very refined and seem to be getting less so every month, ElegantThemes offers many really well-designed themes.

All these paid templates with extensive configuration dialogs (WooThemes, Elegant Themes etc.) usually look nice and are a great alternative if you have little money to spend, little or no template programming skills and you want to be able to tweak how your site looks like.

Not so fast.

Not only do the handy internal configuration tools for "quick customization" give clients every opportunity to break their own sites, they carry a lot of overhead. Your CSS files will be bloated as you are always offering the code for two column, three column and six or seven different colours.

But there's a limit all this configuration options have and you can't get beyond that limit without changing the core files of the template, so if you want to do some serious customization, and not just change the colors, there's nothing good about the configuration screens.

There's a lot of talk about how professional paid themes are in comparison to free themes. It's not what we've found. Cutline, Twenty Ten and Oulipo are all much better coded than any theme we've found at WooThemes or EleganThemes.com. You can't just choose any free theme but a good one looks to be better than a paid theme. There's a couple of reasons. First, a good free theme is not trying to be everything to everyone so most don't suffer featuritis. Second, a free theme is often coded at leisure and only released when it's ready. Paid themes are a commercial product and the more themes a developer can cram out quickly, the more he earns.

Featuritis often means that extra functionality is jammed into the functions file which should be taken care of via plugins. If you add extra functionality via plugins, it's easy to switch themes. If all your custom functionality is in the theme, your website is a prisoner in a pretty gilded cage. We can help you move out, but it's a task.

Here are some concrete case studies of our latest misadventures with paid themes. Read and weep for all the unfortunate site owners who are enduring slow site loads and crashing shared hosting the world over with commercial themes.

Daily Edition by WooThemes - Premium WordPress Templates

When building a site or a plugin, we always check the number of database queries made when displaying the index page, archive page, single post and so on. That helps us discover any bad (by "bad' I mean not necessary) database queries and bad code inside the plugins or templates before a database server goes down because it's overloaded - nothing special on shared hosting environments, it even happens for well optimized and cached sites which have a bad luck of being too popular.

To do this kind of audits use WPDB Profiling plugin for WordPress. It shows you all sorts of information in the site footer and you can turn it on and off as you like.

We built a website with Daily Edition template and when it was all ready to go live, we discovered that it has 85 queries on every page load! It took us a while to figure out where the problem is and it still sounds a bit weird: the number of queries dropped to around 65 after we turned on the "Hide SEO custom fields" option:

daily edition options
Weird Daily Edition Options

How can displaying the SEO custom fields on post edit screens take extra database queries?  We use FV All in One SEO Pack plugin for SEO, so we don't have these problems. But who would guess that turning off unused features can speed up your website so much?

The updated version, which was released shortly after we found these issues has around 60 queries, so this problem appears to be fixed. However, there are more issues. Let's go deeper into PHP here:

The Tabbed widget of Daily Edition is taking too much queries. For example, here's the original popular posts code:

$popularposts = "SELECT ID,post_title FROM {$wpdb->prefix}posts
  WHERE post_status = 'publish' AND post_type = 'post'
  ORDER BY comment_count DESC LIMIT 0,".$pop_posts;
$posts = $wpdb->get_results($popularposts);
if($posts){
  foreach($posts as $post){
    $post_title = stripslashes($post->post_title);
    $guid = get_permalink($post->ID);
    ...
    (display code here)
    ...
    woo_get_image('tiny',35,35,'thumbnail',90,$post->ID,'src',1,0,'','',true,false,false);
    ...
  }
}

That code takes 2 addition database queries for each related post!

Here's how we rewrite the function to avoid that:

  1. use the WordPress function to get the posts - don't use direct SQL commands on wpdb object if possible
  2. use global $post
global $post;
$tmp_post = $post;
$myposts = get_posts('showposts='.$pop_posts.'&orderby=comment_count&order=desc');
foreach($myposts as $post) {
  ...
  (display code here)
  ...
  woo_get_image('image',35,35,'thumbnail',90,$post->ID,'src',1,0,'','',true,false,false);
  ...
}
$post = $tmp_post;

This code takes only 1 query for 1 post and if some of the posts already appear on the page, they are not queried again, thanks to some internal WP caching mechanism. Notice that we store the original $post object in a variable and then put it back.

Going through various templates, you will be probably able to find more glitches like this one.

Delicate News (version 2.0) by Elegant Themes

The template looks great. We do some modifications based on client's requests and everything is fine. It runs on development site with a real set of data copied from the live site, so we should have a good idea about it's performance. The number of database queries is perfectly normal this time.

delicate news template
Delicate News demo template

The problem appears as soon as we take the new site live. There is some inefficient code, as the site runs out of PHP memory. So we quickly troubleshoot the issue, until we found that it's in the template:

Delicate News template tries to use a better count of comments posted to an article than WordPress does and it's running that algorithm each time a post is displayed. On the index page, we display around 10 posts plus this site has a lot of comments - put these two things together and your site goes down like a rock.

Normally WordPress counts number of comments for a post only when a new comment is posted - check out wp_update_comment_count_now in wp-includes/comment.php. Then it stores that in database (wp_posts table, comment_count field). It even provides a plugin hook called wp_update_comment_count.

Here's where the dangerous function is hooking to the standard WordPress template functions:

Line 32 in DelicateNews/includes/functions/comments.php:

if( phpversion() >= '4.4' ) add_filter('get_comments_number', 'comment_count', 0);

Comment out that line and your site will run again:

//if( phpversion() >= '4.4' ) add_filter('get_comments_number', 'comment_count', 0);

So even if you check the number of queries, you are not completely safe. An option to disable a function like this one would be a nice addition to the template configuration screen, or better - a complete rewrite of that function. This is an example of a extra template functionality which does not work as well, at least not in all cases.

We are not saying, that these templates are bad and you should not use them, but if you do, you better check if they are alright, before you use them on some project, as you can't be really 100% sure they work flawlessly in all situations - specially after some tweaks.

Checklist for template checks & optimization

Here are some general steps we follow

  • Use WPDB Profiling plugin for WordPress,
  • Check out the output of WPDB Profiling and look what takes extra queries - you should be able to see plugin functions
  • Make sure you test the template as both logged and non-logged in (with no cache, make sure you enable WPDB Profiling for non-admin users when doing this)

Check following items

  1. Index page
  2. Archive page
  3. Single post
  4. Single post with a lot of comments
  5. Page

To isolate the problematic parts you can

  • Disable plugins
  • Disable sidebar widgets
  • Disable whole sidebar
  • Disable any unusual part of template (front page posts slider, advanced navigation, ...)
wpdb profiling
Excerpt from WPDB profiling analysis. Going through this list can save you a lot of trouble.

Here's a sample pingdom.com site load time report on two minimalist sites, one using a non-repaired paid theme, one using a custom theme built on cutline. One takes 20 seconds to load, the other 4 seconds to load, both on clean fast servers. Guess which one is which.

wordpress cutline custom theme load times
wordpress cutline custom theme load times
wordpress paid themes load time
wordpress paid themes load time

Recommendation

Where possible avoid paid themes at this point. They are all top-heavy. You are much safer starting with Twenty Ten or Cutline. If you must use one, hire a good developer to clean out the theme before going live.

WordPress | 52 comments

Current WordPress 2.4 Admin Theme a Disappointment

Thursday, January 3rd, 2008

WordPress are finally getting around to updating the Admin theme.

This is a great idea. From the beginning WordPress has generally looked great when going out with visitors but she dresses awfully sloppily around the house.

The front end just keeps getting better as the backend stagnates.

Unfortunately, current previews of the updated WordPress 2.4 Admin interface show a getup which looks worse if anything, than what's there now.

I'm having visions of Mambo circa 2004. What's with the dreadful new brown and orange? The blue on blue colour scheme is about all the WordPress Admin Panel has going for it aesthetically.

The only good looking Admin interface for WordPress has been Steve Smith's  WordPress Tiger Administration, which first saw the light of day in June 2005. 

WordPress | No comments

Xray Eyes for CSS

Sunday, December 9th, 2007
Just discovered an amazing bookmarklet from Aussie company Western Civilization, one of the original creators of CSS editing software. StyleMaster was always a little bit buggy processor intensive, expensive and complicated for me so I learned how to code CSS from scratch. I still think that's the best way to write CSS. But the modern web is getting so complicated that we really need a better way to look at web pages to be able to figure out how they are put together. Well WestCiv has really hit the ball out of the park with this one. They have a cross browser compatible javascript bookmarklet that will let you click and see all the CSS and structure for any element on a page. The bookmarklet, appropriately enough, is called Xray.

WordPress | 2 comments