How to Build Themes in WordPress

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:

<?php
$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.

<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//
// 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.

[the_ad_placement id="ghs_side_ads"]

Related Post

Ultimate Guide to WordPress SEO – Yoast

When it comes to WordPress and SEO the only name that usually gets brought up is Yoast. Yoast is an all-in-one SEO plugin that allows seeing how the post ranks and how keyword-heavy your article is. Meaning that you can reach more people looking for your articles or website.   The power of Yoast comes from...

Read More

Why social matters for game development

As a developer one of the most valuable assets at our fingertips is visibility. The more eyes we have on our projects we can start to gauge the excitement and plan accordantly. This is why we must start mapping out how we want to tackle our social branding, marketing, and reach from day one. Without...

Read More

Preventing Burnout as a Software Engineer

As software engineers experience burnout from many things. So today we need to discuss how burnout happens and what can you do to prevent and avoid getting burnout. Before we go over these tips and preventative measures, we need to keep in mind that burnout happens to everyone.

Read More