Skip to content

10 More Tips To Improve Your WordPress Theme

Consistently one of the most popular posts on [wp] is “10 Tips to Improve Your WordPress Theme”, so here are ten more! In this post we’ll look ways to cleverly improve your [theme] not just from the front end but also in the backend with some rather lovely advanced features. And in light of the feedback, list posts will remain. Just slightly better this time.

1. Use a framework

 

Initially, like a lot of people, I wasn’t convinced with frameworks. Now I’m totally won over. Frameworks offer you that crucial starting point for [themes] and save you coding the same things over and over again. And again. And again. These days the choice is massive – from highly complex frameworks with their own hooks such as Thematic, Hybrid and Prodigy to the more simplistic [b]. Download a couple, find one you like, customise it to your needs. You’ll have doubled your coding time with just a couple of hours’ work.

2. Awesome SEO

These days bloggers care more and more about having “awesome SEO”. Understandably too. Theme authors are picking up on this too and increasingly themes are being released marketed with said “awesome SEO”. Thanks to the GPL, many of these themes are actually using the same code! As I wrote a couple of weeks ago, write great content, use your Header tags correctly and use the <title> tag effectively and you’ll be fine – for more SEO tips, check out “10 Ways to Improve Your WordPress Theme’s SEO“.

3. Use an advanced theme options page

options-featured

Again thanks to the GPL, theme options pages, once found only in a select few themes, are now found pretty much everywhere. Creating your own options page isn’t that hard (and needn’t be hard either) – recently [wp] ran “Create an Advanced Theme Options Page” in which, as you might have guessed, we created an advanced theme options page with options such as changing the stylesheet and various other areas of the theme.

4. Don’t use custom fields unneccesarily

Whilst I do love custom fields, I don’t love using them unneccesarily. If you’re making a magazine theme such as the one used on WPShout, you needn’t use custom fields to display images on the homepage or the like (and all this won’t be needed at all with WordPress 2.9 – read more about it here). As WebDeveloperPlus points out, WordPress creates its own thumbnails that can be relatively easily used by any theme using the wp_get_attachment_thumb_url function (codex).

5. Custom write fields!

postoptions

I do love these. Custom write fields. They’re essentially adding little boxes onto the bottom of the post writing area in WordPress. And they’re brilliant. On WPShout I’m running a child theme of [b] and so have a box “Post options” that lets me change the post’s <title>, meta description and set one of two featured images. Adding these custom write fields to a theme is relatively easy with this tutorial I wrote a while ago. With them up and running, you can now offer a number of options and replace plugins such as the “All in one SEO plugin”. Awesome, no?!

6. Use the template hierarchy cleverly

WordPress’ template hierarchy is a great thing and you can create something really awesome by using it correctly. Here’s a case study. You’re using WordPress as a CMS for a portfolio site. You want to use category archives to display the latest blog posts and your portfolio which has a different design completely. You would first need to create two categories, “Portfolio” and “Blog” and find their IDs (although 2.9 onwards you can just use the slug of the category). Let’s pretend “Portfolio” has an ID of 3 and “Blog” 4. Next, style your pages and then save the two files not as category.php (as you would for a category archive normally) but as category-3.php and category-4.php. You’ve now just created two category archives that will output posts completely differently! Awesome, no?

7. Custom widgets

Custom widgets are the next big thing. That’s for sure. Get ahead of the game by including custom widgets in their theme and [s] to [wp] as soon I’ll be writing a tutorial on how to create your own awesome widget.

Download the latest ccna dumps with complete 642-661 notes prepared to help you pass 642-631 on first try.

8. Use sticky posts efficiently and effectively

sticky-post

Used effectively and effectively, you can do a lot of awesome stuff with sticky posts. A number of examples. First, say we just want to highlight sticky posts. With WordPress 2.7’s post_class you can do this by adding some styling for .sticky . The full code would be something like:

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div <?php post_class(); ?>>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>

And with CSS styling:

.sticky{
     background:yellow;
}

As you can see, pretty simple (inspiration for this from Shades of Blue). Taking this further though, you could single out sticky posts and use them instead of that blasted “Featured” category! Mimbo does this particularly well, outputting first a single sticky post and then a seperate loop with the next X posts, excluding the first:

 <?php
	$postCount = 0;
	$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
	query_posts( 'paged=$page&post_per_page=-1&cat=' . get_query_var('cat') );
	while (have_posts()) { the_post();
		if( $postcount == 0 ) {
		//GETS LATEST OR STICKY POST
	?>

<!-- do stuff -->    

		<?php
		}
		elseif( $postcount > 0 && $postcount <= 4 ) {
		//GETS NEXT FOUR EXCERPTS
		?>

<!-- do more stuff -->

<?php endif; endwhile; ?>

9. Multiple sidebars and layouts

An increasing trend this that is done especially well on BinaryMoon.co.uk – having two sidebars – one that gets displayed on the homepage and another that gets displayed in posts:

changing-sidebars

An effect such as this is quite easy to do with the right template hierarchy. First, create two sidebars and save them as sidebar.php and sidebar-single.php. Next, open up the functions.php file and add the following:

<?php if ( function_exists ('register_sidebar')) {
    register_sidebar ('single');
} ?>

Next, open up the single.php file and change to . And you’re done. This is assuming that you want to keep the homepage sidebar on archives. If not, do it the other way round (ie sidebar-home.php). Read more on this at the codex.

10. Custom YARRP templates

I do love this tip from Alex Craggcustom templates for the Yet Another Related Posts Plugin. Using jQuery, Alex created a YARRP template that changes the image as you hover over different posts. Check out the demo here and download the templates here.

And with that, we’re done. Hopefully you’ve now got yourself an awesome WordPress theme! If you’ve enjoyed this post, why not [f] or [s]?

Yay! 🎉 You made it to the end of the article!
Alex Denning
Share:

10 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Rarst
July 31, 2010 7:02 pm

I am getting some weird “Download the latest ccna dumps” links in the middle of this post. Should they be there?.. Just decided worth saying in case it is hack or something.

haritaburada
March 27, 2010 8:52 am

An excellent post. Thank for such an informative approach that we can use extensively in every aspect of our wordpress blogging projects.

Michael Martin
December 21, 2009 1:06 pm

Great post Alex, those are all awesome tips! I’m still not fully sold on frameworks, but maybe I have to give them some more time just!

Epic Alex
December 7, 2009 11:37 am

Thanks for the mention Alex!

As usual, some really great tips here, I really need to look into the multiple sidebar stuff and the option pages.

Il meglio della settimana #41 | BigThink
December 5, 2009 10:40 am

[…] 10 More tips to improve your WordPress theme Alcuni consigli per sviluppare un proprio tema personalizzato. […]

WPSmash.com
December 2, 2009 8:29 am

Thank you for this great post!

Matt B
November 30, 2009 1:53 pm

Wow! I have been using and learning WordPress for quite a while now, and I am always learning something new. In all of my meanderings around the WP community, I somehow never learned that you can have different category templates. I have been working around this issue in other ways, but I think that was certainly the most helpful WP tip yet.

Great article, and keep ’em comin’!

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!