Divi WordPress Them — the smartest and most flexible WordPress theme

Back to Top

Themes’ Problems and How to Find Good (and Free) Ones

Previous Post:

Themes’ Problems and How to Find Good (and Free) Ones

Theme is a great invention, no doubt. But themes, especially free themes or pirated premium themes, also bring many troubles.

How many times have you downloaded a cool-looking WordPress theme just to find out that it doesn’t work as expected, or is out of date? Does it even show a blank white page with a nasty fatal error? Does the theme you just bought allow you to customize things via extensive hook support or just some options in the configuration panel?

The Problems

PHP in theme files

It is popular nowadays for theme files to contain PHP (WordPress, Drupal, Joomla, you name it), they don’t just consist of XHTML and CSS anymore.

WordPress themes are a collection of PHP files that are loaded together with WordPress and use WordPress functions and access WordPress core data in order to deliver HTML output. A theme may (and almost always does) include CSS files, JavaScript files, and image files. Note that WordPress theme PHP files are not “templates” or “documents” in the way that most people think of those words (though the word “template” is sometimes used, it is not strictly accurate). They are PHP script files that are parsed and run on the same exact level and by the same PHP process as all the core WordPress files.Mark Jaquith – Lead WordPress Developer

For such reason, many themes use their own structures for theme files and different naming conventions (archive-category.php, category.php, etc.) which is simply very confusing. If someone would like to customize a theme, he or she will have to study its codes, its variables, its API, or additionally study PHP syntax and WordPress API, etc.

What about all those ready-made themes out there that you can just choose an option or drag and drop some blocks to design the layout? In my opinion, they just give you a false sense of unlimited control, because when you want to add some features that aren’t available yet, you will still have to study all those things above.

Additionally, it is real hard to look at and understand a block of HTML markups with PHP codes placed everywhere. In fact, theme designers aren’t always theme developers, they might write inefficient codes or worse leave security holes in their themes (PHP developers in general also make those mistakes, more codes, more bugs, you know).

If you haven’t noticed already, themes are simply another type of plugin and would be as inefficient as plugins without proper coding: http://buzzdroid.com/wordpress/yslow-and-wordpress-plug ... our-score/.

Now the question is: How can a theme be developed without mixing PHP and HTML? The answer is something called template engine, e.g. Smarty or phpBB’s template engine. Template engine can be understood as a template framework that allows developers to separate codes and designs and eliminate code duplication. Simply put, a template engine allows designers to design a web page without using complicated PHP syntax (PHP codes and HTML markups are in completely different files), and reuse a result block at desired places.

Within the scope of this article I can not go into details about template engine (refer to the Further Reading section for more articles on that matter), but you can take a look at some codes below and have your own comparison:

Designers that design using phpBB’s template engine:

  1. <!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
  2. <span class="text">{L_WELCOME_USER}</span>
  3. <!-- ELSE -->
  4. <span class="text">{L_WELCOME_GUEST}</span>
  5. <!-- ENDIF -->
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
<span class="text">{L_WELCOME_USER}</span>
<!-- ELSE -->
<span class="text">{L_WELCOME_GUEST}</span>
<!-- ENDIF -->

Designers that design using PHP themes:

  1. <?php if (is_user_logged_in() && !is_bot()) { ?>
  2. <span class="text"><?php _e(sprintf('Welcome %s', get_username())); ?></span>
  3. <?php } else { ?>
  4. <span class="text"><?php _e('Welcome Guest'); ?></span>
  5. <?php } // endif ?>
<?php if (is_user_logged_in() && !is_bot()) { ?>
<span class="text"><?php _e(sprintf('Welcome %s', get_username())); ?></span>
<?php } else { ?>
<span class="text"><?php _e('Welcome Guest'); ?></span>
<?php } // endif ?>

What is cleaner and more elegant you might ask? The answer is pretty obvious. With a template engine, a designer can design a theme by working with HTML markups and CSS only while an experienced PHP developers will take care of the rest, which is way better.

Not easy to customize

As stated above, end-users might have a hard time modifying the theme to their needs.

Let’s take a look at WordPress.org Themes and Templates support forum, apart from having over 1,978 pages (at the moment of writing), this forum consists of many questions about users messing up theme files with their clunky PHP codes (not everyone has the money to hire PHP developers to customize the theme for them).

Example topics can be:

In my humble opinion, this is the result of what we call giving too much control over the codes to themes (not to mention the fact that some themes are encrypted, yuck!)

To give you a closer look at how “clean” and “easy to customize” a theme can be, I will copy this code snippet from Twenty Ten’s loop.php (it is the default theme since WordPress 3.0 in case you don’t know):

  1. <?php
  2.     /* Start the Loop.
  3.      *
  4.      * In Twenty Ten we use the same loop in multiple contexts.
  5.      * It is broken into three main parts: when we're displaying
  6.      * posts that are in the gallery category, when we're displaying
  7.      * posts in the asides category, and finally all other posts.
  8.      *
  9.      * Additionally, we sometimes check for whether we are on an
  10.      * archive page, a search page, etc., allowing for small differences
  11.      * in the loop on each template without actually duplicating
  12.      * the rest of the loop that is shared.
  13.      *
  14.      * Without further ado, the loop:
  15.      */ ?>
  16. <?php while ( have_posts() ) : the_post(); ?>
  17.  
  18. <?php /* How to display posts in the Gallery category. */ ?>
  19.  
  20.     <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
  21.         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  22.             <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  23.  
  24.             <div class="entry-meta">
  25.                 <?php twentyten_posted_on(); ?>
  26.             </div><!-- .entry-meta -->
  27.  
  28.             <div class="entry-content">
  29. <?php if ( post_password_required() ) : ?>
  30.                 <?php the_content(); ?>
  31. <?php else : ?>
  32.                 <?php
  33.                     $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  34.                     if ( $images ) :
  35.                         $total_images = count( $images );
  36.                         $image = array_shift( $images );
  37.                         $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  38.                 ?>
  39.                         <div class="gallery-thumb">
  40.                             <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  41.                         </div><!-- .gallery-thumb -->
  42.                         <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
  43.                                 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  44.                                 $total_images
  45.                             ); ?></em></p>
  46.                 <?php endif; ?>
  47.                         <?php the_excerpt(); ?>
  48. <?php endif; ?>
  49.             </div><!-- .entry-content -->
  50.  
  51.             <div class="entry-utility">
  52.                 <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
  53.                 <span class="meta-sep">|</span>
  54.                 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  55.                 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  56.             </div><!-- .entry-utility -->
  57.         </div><!-- #post-## -->
  58.  
  59. <?php /* How to display posts in the asides category */ ?>
  60.  
  61.     <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : ?>
  62.         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  63.  
  64.         <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
  65.             <div class="entry-summary">
  66.                 <?php the_excerpt(); ?>
  67.             </div><!-- .entry-summary -->
  68.         <?php else : ?>
  69.             <div class="entry-content">
  70.                 <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
  71.             </div><!-- .entry-content -->
  72.         <?php endif; ?>
  73.  
  74.             <div class="entry-utility">
  75.                 <?php twentyten_posted_on(); ?>
  76.                 <span class="meta-sep">|</span>
  77.                 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  78.                 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  79.             </div><!-- .entry-utility -->
  80.         </div><!-- #post-## -->
  81.  
  82. <?php /* How to display all other posts. */ ?>
  83.  
  84.     <?php else : ?>
  85.         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  86.             <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  87.  
  88.             <div class="entry-meta">
  89.                 <?php twentyten_posted_on(); ?>
  90.             </div><!-- .entry-meta -->
  91.  
  92.     <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
  93.             <div class="entry-summary">
  94.                 <?php the_excerpt(); ?>
  95.             </div><!-- .entry-summary -->
  96.     <?php else : ?>
  97.             <div class="entry-content">
  98.                 <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
  99.                 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
  100.             </div><!-- .entry-content -->
  101.     <?php endif; ?>
  102.  
  103.             <div class="entry-utility">
  104.                 <?php if ( count( get_the_category() ) ) : ?>
  105.                     <span class="cat-links">
  106.                         <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  107.                     </span>
  108.                     <span class="meta-sep">|</span>
  109.                 <?php endif; ?>
  110.                 <?php
  111.                     $tags_list = get_the_tag_list( '', ', ' );
  112.                     if ( $tags_list ):
  113.                 ?>
  114.                     <span class="tag-links">
  115.                         <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  116.                     </span>
  117.                     <span class="meta-sep">|</span>
  118.                 <?php endif; ?>
  119.                 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  120.                 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  121.             </div><!-- .entry-utility -->
  122.         </div><!-- #post-## -->
  123.  
  124.         <?php comments_template( '', true ); ?>
  125.  
  126.     <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
  127.  
  128. <?php endwhile; // End the loop. Whew. ?>
<?php
	/* Start the Loop.
	 *
	 * In Twenty Ten we use the same loop in multiple contexts.
	 * It is broken into three main parts: when we're displaying
	 * posts that are in the gallery category, when we're displaying
	 * posts in the asides category, and finally all other posts.
	 *
	 * Additionally, we sometimes check for whether we are on an
	 * archive page, a search page, etc., allowing for small differences
	 * in the loop on each template without actually duplicating
	 * the rest of the loop that is shared.
	 *
	 * Without further ado, the loop:
	 */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php /* How to display posts in the Gallery category. */ ?>

	<?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

			<div class="entry-meta">
				<?php twentyten_posted_on(); ?>
			</div><!-- .entry-meta -->

			<div class="entry-content">
<?php if ( post_password_required() ) : ?>
				<?php the_content(); ?>
<?php else : ?>
				<?php
					$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
					if ( $images ) :
						$total_images = count( $images );
						$image = array_shift( $images );
						$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
				?>
						<div class="gallery-thumb">
							<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
						</div><!-- .gallery-thumb -->
						<p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
								'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
								$total_images
							); ?></em></p>
				<?php endif; ?>
						<?php the_excerpt(); ?>
<?php endif; ?>
			</div><!-- .entry-content -->

			<div class="entry-utility">
				<a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
				<span class="meta-sep">|</span>
				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
			</div><!-- .entry-utility -->
		</div><!-- #post-## -->

<?php /* How to display posts in the asides category */ ?>

	<?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

		<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
			<div class="entry-summary">
				<?php the_excerpt(); ?>
			</div><!-- .entry-summary -->
		<?php else : ?>
			<div class="entry-content">
				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
			</div><!-- .entry-content -->
		<?php endif; ?>

			<div class="entry-utility">
				<?php twentyten_posted_on(); ?>
				<span class="meta-sep">|</span>
				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
			</div><!-- .entry-utility -->
		</div><!-- #post-## -->

<?php /* How to display all other posts. */ ?>

	<?php else : ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

			<div class="entry-meta">
				<?php twentyten_posted_on(); ?>
			</div><!-- .entry-meta -->

	<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
			<div class="entry-summary">
				<?php the_excerpt(); ?>
			</div><!-- .entry-summary -->
	<?php else : ?>
			<div class="entry-content">
				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
				<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
			</div><!-- .entry-content -->
	<?php endif; ?>

			<div class="entry-utility">
				<?php if ( count( get_the_category() ) ) : ?>
					<span class="cat-links">
						<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
					</span>
					<span class="meta-sep">|</span>
				<?php endif; ?>
				<?php
					$tags_list = get_the_tag_list( '', ', ' );
					if ( $tags_list ):
				?>
					<span class="tag-links">
						<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
					</span>
					<span class="meta-sep">|</span>
				<?php endif; ?>
				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
			</div><!-- .entry-utility -->
		</div><!-- #post-## -->

		<?php comments_template( '', true ); ?>

	<?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>

<?php endwhile; // End the loop. Whew. ?>

While Twenty Ten is a feature-rich theme, can pure-designers and users comprehend such long and complicated codes? I highly doubt that, and look at the last line, isn’t that hilarious?

By the way, on the official WordPress.org Support forum you will see a small description that says “XHTML and CSS” under the Themes and Templates support forum. Where is PHP? Isn’t PHP required to develop a WordPress theme? This might give visitors a false sense that the forum deals with XHTML and CSS only, while countless support questions in that forum are about PHP…

More dependencies

Back in the time when themes are “called” templates, they only consist of pure .html or .tpl files along with images, javascript, etc. and no server-side requirement is needed. WordPress themes, with a bunch of PHP codes inside (plus database reading and writing), PHP and database version requirement is now needed.

Finding a Good Theme

The current themeing mechanism will never make use of template engine I suppose, so you’ve got only one choice: find a good theme and stay away from inefficient themes (even if they look cool). You should not worry too much, though, because there are many themes out there that are actually very good.

You should always choose a theme based on your situation and needs:

If you want to simply download, install, and use

I would definitely go to WordPress Theme Directory and choose one of those popular themes listed on the right side without hesitation. Those theme are simply good looking, well-written, and well-structured (you should not use zBench, however).

I myself have used LightWord and Arras and they are truly amazing. Although Arras might be an overkill for a theme but it is overall good (for the current purpose of course). Platform is too heavy in my opinion.

Another great choice is Mystique, an elegant theme that makes use of Javascript in a stylish way.

If you want to customize an existing theme

Some people choose to create a child theme using Twenty Ten, and I would like to suggest against that. The number of bugs regarding Twenty Ten makes me feel like the new default WordPress theme is created just to show off the new features without many enhancements to the core (look at how it handles the page title and you will understand what I mean…)

So, what theme to choose then? It will not be easy to put a title here, but the point is you should not choose themes that provide a lot of settings in the admin panel, because the more settings you have, the less you can customize the theme. Some themes can look very nice in their screenshot with pictures and colorful blocks, but don’t let them fool you, they are only suitable for people who want to download, install and use like above. The functionality provided by themes should be provided by existing plugins instead, because it is definitely uncool to reinvent the wheel, don’t you think?

If you want to develop a theme from scratch

You should use a theme framework, no doubt. A theme framework is often developed by experienced PHP developers, so you do not have to worry much about inefficient coding.

Currently the only free theme framework that I find suitable for large-scale development is Hybrid; what I like about this framework is the theme files’ organization in appropriate folders, very clever. The only thing I dislike is there are too many files to work with and some of the files are almost identical; this somehow beats the main purpose of template: less code duplication. For example, you would like to change the overall markups present on day.php, you would probably need to change that on hour.php too and so on.

The other major theme frameworks are not free, but they might worth every penny. As far as I know, Genesis is recommended. Another option is Thesis which I have not used myself but there are a lot of people out there who are using it already, so you should give it a try (keep in mind the copyright incident regarding this framework, though).

The Bottom Line

Basically, never use a theme that boasts too many features, such theme will just eliminate the purpose of plugins in the first place and be very hard to customize as you please. Also, do not download pirated premium themes because most of the time there will be advertising contents or encrypted crap inside them.

That’s all I have to say and I hope this article will be useful to you, ’til next time!

Further Reading

Bad functions.php file for Atahualpa Theme

Print Article Trackback Trackback to this Article   Subscribe to Comments RSS Subscribe to Comments RSS

2 Opinions for Themes’ Problems and How to Find Good (and Free) Ones (2 Trackbacks)

  1. WordPress’s Memory Usage, should it be one of your concerns? « Better WordPress

    [...] Theme’s problems and how to choose good ones [...]

  2. Organizing Theme Files « BetterWP.net

    [...] you have read another article named WordPress Themes’ Problems and How to Find Good Ones on betterwp.net, you would know that WordPress Themes have many potential problems and one of which [...]

Speak Up Your Mind!

An asterisk (*) indicates a required field and must be filled.




  • Web page and e-mail addresses turn into links automatically.
  • Wrap codes in: <code lang=""></code> or <pre lang="" extra="">
  • Lines and paragraphs break automatically.

Next Post: