2011 In Review

According to WordPress, I wrote a total of 190 posts in 2011. To see all the articles written in 2011, simply access:


This feature is possible using one of the nicest features in WordPress called permalinks, which is short for permanent links. With permalinks, you can customize your own URL structure the way you want it. I happen to use this format:


which makes it easier for me to display articles by year, month and day. To access all articles written in 2011, I just provide the year and all articles written in 2011 will be displayed. Most WordPress users already use permalinks.

If you are not, do it early. Over the years, you’ll see the benefit of using such a structure.

Display On WordPress Single Pages Only

I recently had to display some content on my blog, only when my blog is displaying a single article or a single post. The content does not appear on the home page or any other page. Since my blog is powered by WordPress, there are several WordPress functions that I can use to detect if the current page is a single post, a home page or a WordPress Page, e.g. the About page. Here’s the code:

Single Posts

<?php if(is_single()) : ?>
My single post content goes here!
<?php endif; ?>

Home Page

<?php if(is_home()) : ?>
My home page content goes here!
<?php endif; ?>


<?php if(is_page()) : ?>
My Page content goes here!
<?php endif; ?>

The content located between the if and endif statements will be displayed only if the conditional is true. You can use this code to customize the content of your blog. You can place this code in your WordPress theme files such as index.php, home.php, single.php, and page.php.

Display Number of Posts On WordPress Themes

For WordPress Theme developers who want to display the number of WordPress posts on their themes, there is already a built-in function in WordPress that makes it easy to add stats to your templates. To display the number of posts, just add this code in your templates:

<?php wp_count_posts( $type, $perm ); ?> posts

$type and $perm are optional. You can omit them.

Place the code on the sidebar or the footer to display.