How to Write A Simple WordPress Theme

Here are the basic steps for creating a simple WordPress theme:

  1. Start by creating a new folder for your theme in the wp-content/themes directory.
  2. Create a file called style.css in your new theme folder and add the following code to it:
/*
Theme Name: My Simple Theme
Author: Your Name
Author URI: http://yourwebsite.com
Description: A simple WordPress theme
Version: 1.0
*/
  1. Next, create a file called index.php in your theme folder and add the following code to it:
<?php

get_header();

if ( have_posts() ) {
  while ( have_posts() ) {
    the_post();
    the_title();
    the_content();
  }
}

get_sidebar();
get_footer();
  1. Then, create a file called functions.php in your theme folder and add the following code to it:
<?php

add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );

register_nav_menus(
  array(
    'header-menu' => __( 'Header Menu' ),
    'footer-menu' => __( 'Footer Menu' )
  )
);
  1. Finally, upload your theme_folder to the themes and go to the WordPress admin dashboard and activate your new theme. You can then customize your theme by editing the style.css and functions.php files, and by adding new templates for specific pages or post types.