Skip to content
Menu
i do, therefore i am
  • Home
  • Blog
  • Contact us
i do, therefore i am
October 2, 2022November 7, 2022

A WordPress theme from scratch 1

Creating the theme

I know nothing about WordPress. Like many others, I am just a user. For a long time, I have wanted to understand at least the basics of WordPress themes and perhaps be able to customize those used in my blog. So I set up on a quest to learn more about it. This is a documentation of my learning endeavors during this journey.

Create theme directory

The first step in a creating a theme consists of creating the necessary directory and file structure in the WP themes directory. I am going to call this theme my-first-theme.

We need to start somewhere and the best thing is to navigate to the WordPress installations directory which usually lies on /var/www/html.

cd /var/www/html
cd wp-content/themes

Let’s create a directory for the new theme.

mkdir my-first-theme

Create the basic files

For the theme not to be considered as ” broken”, WordPress requires at least the files: style.css and index.php to exist.

style.css

In addition to (perhaps) containing your stylesheets, the file style.css contains the information WordPress know about your theme.

/*
    Theme Name: JALF
    Theme URI: https://laurencio.de/themes/my-first-theme
    Author: Juan Laurencio
    Author URI: https://laurencio.de 
    Version: 0.1.alpha
    License: General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Description: first wordpress theme
    Tags: black, white, responsive, one-column, two-columns, featured-images, custom-menu, custom-header, post-formats
*/

index.php

<?php get_header(); ?>
<p>You do not need to write anything here</p>
<?php get_footer(); ?>

We also create the files header.php and footer.php and “insert” them in the index.php by calling the functions gt_header() and get_footer()

header.php

<!doctype html>
<head>
  <meta charset="utf-8">
  <title>Insert title here</title>
</head>
<body>

footer.php

    <footer>
      <p>
        this is a footer
      </p>
    </footer>
  </body>
</html>

https://www.youtube.com/watch?v=oTRZYnYQlmo&list=PLriKzYyLb28nUFbe0Y9d-19uVkOnhYxFE

Leave a Reply Cancel reply

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

Recent Posts

  • vim as Hex-Editor
  • installing pico-sdk in wsl
  • A WordPress theme from scratch 5
  • A WordPress theme from scratch 4
  • Serial Port Windows

Recent Comments

    Archives

    • May 2023
    • January 2023
    • November 2022
    • October 2022
    • September 2022
    • May 2022
    • April 2022
    • March 2022
    • February 2022
    • January 2021

    Categories

    • Fortran
    • linux
    • Postgresql
    • Programming
    • Python
    • Tools, tips and tricks
    • Wordpress

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Postgres

    • postgres-docs

    Python

    • data model
    • the standard library
    • python tips
    • import system
    • asyncio
    • built-in functions

    Open_VMS

    • lexicals at marc’s place
    • documentation and manuals
    • system services
    • rms services reference
    ©2025 i do, therefore i am | Powered by WordPress and Superb Themes!