Serie WordPress Theme development
This series is about what is a WordPress Theme and how can we create our own one.
You will find brief chapters about specific topics which will be published periodically.
Let’s start with the beginning.
Chapter 1. What is a WordPress Theme?
A WordPress Theme has a purpose which includes structuring your content and providing the personality of your web site through a combination of files and file types. For instance, a WordPress Theme keeps the style with CSS files and the structure and logic with PHP files. But what are they and what is the purpose of them?
Let’s see the different types of files we can find within a Theme:
Template files are PHP code files that control what content gets shown to the visitors. These files also render the HTML to the browser to control how the content is shown. Each web site is different from another so the number of templates files depends on the site’s structure. If you want to go deeper the topic, I suggest taking a look of the Template Hierarchy, which is the mechanism WordPress uses to determine which templates to show depending on which page you are visiting.
It is the style sheet, CSS files help to define how the HTML elements will be displayed. Developers will define which margin, font, size, border or spacing should have the HTML elements.
The primary style sheet for the theme must be style.css.
This is an example of a style.css file definition which shows the most important theme properties:
/* Theme Name: Twenty Seventeen Theme URI: https://wordpress.org/themes/twentyseventeen/ Author: the WordPress team Author URI: https://wordpress.org/ Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a focus on business sites, it features multiple sections on the front page as well as widgets, navigation and social menus, a logo, and more. Personalize its asymmetrical grid with a custom color scheme and showcase your multimedia content with post formats. Our default theme for 2017 works great in many languages, for any abilities, and on any device. Version: 1.7 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: twentyseventeen Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready 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. */
Images and Assets
These assets are used in the theme to give your web site the look you want. They are usually placed in a subfolder of the theme’s main directory.
Plugins contribute advanced functionality to a web site. They are sometimes needed to achieve a purpose in the theme. Third-party plugin or extensions could add specific features to a theme.
The plugins should go in the Plugins folder and intended to extend functionality.
Do you want to carry on with Chapter 2 Creating your own WordPress Theme: Style.css?