Positive Knight

WordPress Theme Development Tutorial. Part 1

WordPress Theme Development Tutorial. Part #1

Hello all! I am going to create my own WordPress Theme from scratch starting from today. Actually, I am going to go through all WordPress Theme Development Handbook and create one theme.

So, today is the day one.

In WordPress Theme Development Handbook is mentioned that there are only two files absolutely required in a WordPress theme:




So, I am going to create them now.

File index.php

The simplest index.php file can contain next code:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    if ( have_posts() ) : 
        while ( have_posts() ) : the_post();
    else :
        _e( 'Sorry, no posts matched your criteria.', 'scratchok' );
In reality this code will be more complicated. But for now it should work.

File style.css

The next file style.css should contain at least one multi-line comment with special fields like this:
Theme Name: scratchok
Theme URI: https://positiveknight.com/
Author: wpok13
Author URI: https://positiveknight.com/
Description: Theme created from scratch for online tutorial.
Tags: blog, custom
Version: 1.0
Requires at least: 5.0
Tested up to: 5.4
Requires PHP: 7.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: scratchok

Leave a Reply

Your email address will not be published. Required fields are marked *