Video Tutorial Theme creation
We will now get to the heart of the matter and create the first files of our theme.
The necessary files
To create a WordPress theme you must create a new folder in the folder
wp-content / themes and place a first php file named
index.php. This file will be automatically used to generate the pages of your theme. You will also need to create a file
style.css which will contain the style of our theme but especially a comment that will allow WordPress to know the information of your themes.
The only information required is the name of the theme.
/ * Theme Name: My theme * /
But it is possible to insert more information if you wish. For example here is the code present in the TwentyTwenty theme.
/ * Theme Name: Twenty Twenty Text Domain: twentytwenty Version: 1.1 Requires at least: 4.7 Requires PHP: 5.2.4 Description: Our default theme for 2020 is designed to take full advantage of the flexibility of the block editor. Organizations and businesses have the ability to create dynamic landing pages with endless layouts using the group and column blocks. The centered content column and fine-tuned typography also makes it perfect for traditional blogs. Complete editor styles give you a good idea of what your content will look like, even before you publish. You can give your site a personal touch by changing the background colors and the accent color in the Customizer. The colors of all elements on your site are automatically calculated based on the colors you pick, ensuring a high, accessible color contrast for your visitors. Tags: blog, one-column, custom-background, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-width-template, rtl-language-support, sticky- post, theme-options, threaded-comments, translation-ready, block-styles, wide-blocks, accessibility-ready Author: the WordPress team Author URI: https://wordpress.org/ Theme URI: https://wordpress.org/themes/twentytwenty/ License: GNU General Public License v2 or later URI license: http://www.gnu.org/licenses/gpl-2.0.html All files, unless otherwise stated, are released under the GNU General Public License version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) This theme, like WordPress, is licensed under the GPL. Use it to make something cool, have fun, and share what you've learned with others. * /
Then, inside the index.php page you can put the first basic structure.
Here your content
These functions are WordPress functions that will automatically search for files
footer.php in your theme. The file
header.php should include the header of your page as well as a call to the method
In the footer part we will do the same but with the method