My Way to Prepare WordPress Theme Development

I’ve developed many WordPress themes but not much. According to my experiences, I have several ways to set up the development.


Creating blank files needed, those are:

  • header.php
  • index.php
  • single.php
  • page.php
  • archives.php
  • footer.php
  • functions.php
  • style.php


Create folder for related files. For example: If you want to place images for your theme you should create images folder. If your theme contains javascript there must be .js files, so put it together in js or javascript folder. And if you have other file types you should create folder for those.


The most important step is linking your style.css to your whole theme. So, do it first before you do the other things, unless you will be messed up.

WordPress “Error establishing a database connection” Checklist

If it is your first time to install WordPress, you can get annoying Error establishing a database connection. There must be some reasons why this annoying error message appears. Here are the checklist that may help you out:

  • Check that your database is correct. When you create a database manually in cPanel. You must be enter the name such as “newsite”, “mysite”, or else. But, when it’s done. It becomes yourusername_databasename. If your username in your webhosting is “becca” and your database name “newsite”, your correct database name is “becca_newsite” NOT “newsite”.
  • Don’t forget to add user to your MySQL database! This can be hideous, so please treat it carefully.
  • Set the right database password when installing WordPress. Where can you get it? It is when you create MySQL user. If you are using fantastico, the password will automatically generated.
  • Make sure the database is online by seeing server status at the left bottom corner in cPanel.

If you are sure you have completed the checklist and still error, you should contact your webhosting provider.

How to Restrict User Access to Some Features in WordPress

You can rule your members of your WordPress site as administrator, editor, contributor, or subscriber. But if you want to restrict user access to some features such as deleting/editing post, change WordPress global settings, and even updating your plugins and themes, you should install plugin.

Continue reading How to Restrict User Access to Some Features in WordPress

Installing WordPress Locally on MacOs 10.6.6 Gives Trouble?

You should know that localhost can be accessed trough

  • localhost
  • localhost:80
  • localhost:8080

Depending your default configuration on your Mac. In Mac you can access your localhost by http://localhost/username/. If you have trouble with http://localhost/username/folder/ shows 404. It is maybe about permalink and .htaccess on your webserver.

In this case, WordPress won’t show up. So, the problem can be your webserver settings.

Please learn about MacOs localhost trouble.

The Difference Between get_posts() and query_posts() in WordPress

Many WordPress theme developers get confused by get_posts() and query_posts() functions at the first time they faced it.

get_posts() description: This is a simple function for creating multiple loops. It retrieves a list of latest posts or posts matching criteria.

query_posts() description: query_posts() can be used to control which posts show up in The Loop… The query_posts() function is intended to be used to modify the main page loop only. It is not intended as a means to create secondary loops on the page.

Yes the difference is about multiple loops and single loop.

Continue reading The Difference Between get_posts() and query_posts() in WordPress

Customizable the_excerpt() length in WordPress

Do you want to make different excerpt length using the_excerpt() function? Basically you can only create one different length. It is about adding length filter to the excerpt more. But, you’ll only get two: the original excerpt and your modified excerpt.

Here is customizable the_excerpt() length function that can be useful for your theme development especially when you create a news theme. Place this code to your functions.php in WordPress theme editor.

Continue reading Customizable the_excerpt() length in WordPress

Best Plugins for WordPress Starter

What is the best plugins for starting WordPress blog? These are the plugins that will make your life of blogging easier.

That’s my list, what’s yours?

How to Create Random Post at the Bottom of the Post in WordPress

Creating random post at the bottom of the WordPress post is easy. How to create it?

Just cut paste code below to your Appearance -> Editor -> single.php

    $rand_posts = get_posts('numberposts=5&orderby=rand'); // you can set numberposts as you want
    foreach( $rand_posts as $post ) :
   <div class="post">
       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
<?php endforeach; ?>

Save it once you’re done

How to Add Thumbnail / Featured Image in a Post – WordPress

To add a thumbnail or Featured Image in a post is pretty easy. You can open your Appearance > Editor > single.php from your WordPress Administrator Page.

Add this line

<?php the_post_thumbnail('thumbnail');?>

If you want to customize the size you can add line like this to add width: 270px and height: 270px

<?php the_post_thumbnail(array(270,270));?>

Easy isn’t it?