Creating a WordPress theme (template)
This is the main page of the WordPress theme (template) creation guide. The basic information is taken from the official manual and from personal experience.
WordPress theme is a set of css, js, php files that in conjunction with WordPress and plugins display information from the database on the screen in a beautiful and convenient form (design). Well, or ugly and uncomfortable, then looking what topic to choose… In other engine theme still call “template”, but in WordPress adopted to speak precisely theme-theme, not pattern-template. Although and the and another essentially one thing and, too,…
Thus, if you change the theme, the site changes its appearance, looks different. On WordPress.org there are thousands of free themes. Despite the wide choice of themes, many prefer to create their own themes. This is primarily due to the fact that it is not difficult to create a simple theme.
To create a theme only two files are needed:
index.php-the main theme file, responsible for the output of the content
style.css-the main style file, responsible for css styles
But no topic in fact does not consist of only two files. There are more of them: PHP, language files, CSS and JS file, text files. The theme starts with two files, and then, to make it easier, extend it by adding the following file:
header.php-responsible for output caps
footer.php-responsible for the output of the basement
sidebar.php-responsible for the output of the sidebar
page.php-responsible for the output of a separate page (record).
The possibilities of the theme are essentially limitless, because there you can fully use PHP. BUT! Theme, as designed to display the content of the site in a certain way, and not add functionality to the site. So opportunities themes adopted limit until those, which respond for external kind of, and all the rest opportunities: the vote, ratings, redirects, SEO and camping on p. adopted learn in plugins…
So the theme can:
Be responsible for displaying the content of the site for different types of devices: monitors and smartphones. Such topics are called adaptive. Also themes can be fixed, one-column, two-column, etc.;
The theme can display any content;
Can specify which content will be displayed to different users;
Can use any design elements (pictures, videos).
As with any site, the theme is not only a color scheme, layout and beautiful picture. Really high-quality themes are also very functional. The functionality of the theme lies in its flexible configuration. I. e. it does not add anything new to the site, but it is perfectly configured to the taste of the owner. For example: the background picture is set, the colors of the elements are changed, the menu and content blocks (widgets) are configured.
What is the difference between a theme and a plugin?
From the point of view of the code, we can say nothing — you can create a full-fledged plugin in the theme. But from the point of view of logic — all! The task of the plugin is to add something new to the site, for example add a survey. The task of the topic is to display the content, including this survey…
Thus, the theme is responsible for displaying content on the page, and the plugin is needed to implement the functionality of the site.
Never add functionality to the theme itself unless there is a good reason to do so. If you do this, then when you change the theme, the functionality will be lost in place with it. For example, your theme has a cool photo gallery. And if you change the subject, then this cool photo gallery will be lost…
Therefore, any functionality associated with editing/adding site content should be designed as a plugin.
Where to download themes?
Catalog of topics on the site WordPress.org — one of the safest places to download themes. There, all topics are checked for compliance with requirements and recommendations.
There are other sources, but there are usually paid topics. For example, themes can be downloaded from: Creative Market.
Now that we understand the themes, you can start creating your own theme. The first thing you need:
configure your local development environment.
Then you can see examples of WordPress themes.
Ah and start designing its the first themes.