How to Build Themes in WordPress
  • user-image

    By Steven Ghost Rivera

  • March 10, 2017


When building a theme in WordPress you must keep in mind what you want this theme to do. With this theme, you can accomplish anything that you want or/and need. It’s just what you want to do with it is where you would like to start planning out. For right now we will just go over the basics and get your theme from concept to acceptable.

Where Do I Start?

This is the place where planning everything out is going to be key. The best way for me is to sketch it out even if it’s very simple and just a skeleton of what you want. Most of the time it’s just a wireframe of my design and I wing the rest of it. Here’s an example of what I’m talking about.

Once you have this done keep in mind that once the coding starts things will change. I am being completely honest right now, things will changes! The reason for this is because the design itself will need something that you may not be thinking of right away or even something may not flow right. This is completely nature and a part of the developer process.

What Languages Will I Use?

So working on WordPress theme you will be using three major languages. These languages are going to be JavaScript, PHP, and HTML with CSS. The majority is going to be PHP so if you want to know how to start let us start here.
Coding in PHP for WordPress
The first thing you will have to do is tell the file that you’re using PHP by using the <?php tag. After that you can write your code like this:

$post = ”;

For all that aren’t aware using $ in front of a word is how we declare variables. You can declare anything just by writing $var (var is just a placeholder) = whatever you want. The first thing will need to do is learn how to grab our posts. We do that by using the loop for checking and getting our post.

if ( have_posts() ) {
while ( have_posts() ) {
// Post Content here
} // end while
} // end if

The have_posts() function is what we use to check if we have any post to display. After that, we need to run a while to run for every post will have to display. Then using the the_post() function is to get the post data.

If we add the the_title() function after the the_post() function this will we display the title for the post. Now it’s time to display the body or the content using the the_content(). Now we have a page that will display all our post with titles and content but I think it time to start styling, don’t you?

Let’s leave that for the next post. However in the meantime why not take a look at using the WordPress REST API.

Leave a Reply

We are an Indie Studio trying to create games that our former selves would be proud of.