I have just finished front-end development for my new word press website: html+css+js. Now I want to back end it to wordpress, but after I looked at a bunch of lessons and read a lot of literature (really a lot). I didn’t find a universal explanation. I already asked a question here, people advised MODX, but there are even fewer clear lessons.
How to make a template for word press? a theme for a CMS, having a custom-made front-end files?
Are their some standard expressions suitable for any front-end files?
PS. I do not know php.
Create a theme or "stretch" the front-end layout on the CMS is not just some kind of transfer of markup from one file to another. Often it is the implementation of the functionality that is displayed in the layout. For example, if there is a block with phone numbers in the header, then you need to foresee how these numbers will be added from the admin panel and how to display them. If there is a block in the "Latest News" layout with article cards, it means that when creating a topic, you need to somehow organize the collection of the latest entries and then their output. In this regard, WP has, of course, ready-made solutions, but often if you take them out of the box, then they are displayed with the layout that the WP developers provided, otherwise you have to either redo your layout or delve into how the ready-made solution somehow change it. So without PHP it will be hard. If nothing unusual is needed, then everything is quite simple.
The WP theme consists of css styles, and php template files, as well as the functions.php script, which is more responsible for the functionality. You can create a theme from scratch, or inherit from some finished one, and override templates and styles in it.The main theme file, oddly enough, is style.css. First, in the / wp-content / themes / folder, create a new directory, create a style.css file in it and throw a comment into this file:
Theme Name: Theme name
Author: Put your name here
Text Domain: put your contacts here
If you want to inherit from another Wp Theme, you'll need to add another Template and specify the name of the topic, or rather the folder where the topic lies.
Theme Name: WP Theme Name
Author: Your Name
Text Domain: Your Contacts
Further, if you need to redefine the template, just create a file with the same name in your folder, it will be taken in priority. The only thing there is a nuance with functions.php, since the parent is executed before yours.
Working from scratch, without inheritance, you need to add the index.php, header.php, footer.php and screenshot.png files, it will appear in the admin as a preview of the theme, the last one, if I'm not mistaken, is not necessary. The file header.php is responsible for displaying the header, footer.php - the footer. index.php is responsible for all requests, If there is no more appropriate template file. 404.php is responsible for 404 error. page. php is responsible for displaying the page (in WP you can create separate pages), category.php for displaying the categories page, single.php for displaying one record, and so on.
Templates can be created more flexibly, for example, for a specific type of record, or for records that have another output template set in the admin panel, for more information about the theme files here, and word press programming in general visit the Codex
WP has a system of widgets and plug-ins that greatly expand the capabilities of the engine. WP offers the registration of its taxonomies, record types and all that stuff. Look at the site that gave the links above, and also gave the codex word press link above in the responses.
As for the other CMS's, I would say each has its own way, for example, OpenCart uses the Twig template engine, and the engine itself is written in MVC, that is, the functionality is separate from the display, so it is easier to edit templates, almost one html, WP is worse, everything interspersed with php.
PS: while creating a theme there are many more subtleties, for example, to connect your styles, your own JS, you need to know the concept of hooks, and connect scripts and styles through calling functions, which in turn must subscribe to events, that is, hooks ... So, Wp is not the easiest option, if all these concepts are far from understanding, but there are articles, videos, docks. Successes!