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