![]() ![]() How do we know which assembly line a given bundle will go down? With the WordPress template hierarchy. Putting our posts through index.php will result in a webpage that looks one way putting it through home.php, archive.php, or page.php will give very different results. However, the theme provides a lot of possible lines to send those posts down: our different PHP templates. Learning this hierarchy will let you pinpoint which of your webpages will use which template.Īs go through these details, remember the following analogy: WordPress is a factory that processes raw material, posts, into finished products, webpages.Īt the point where the template hierarchy comes into play, we’re in the stage of the production process where a bundle of posts has been fetched out of the warehouse (the database), and are all ready to be assembled and made to display beautifully by our assembly line, the WordPress theme. The template hierarchy follows a defined order set in WordPress itself.The WordPress template hierarchy determines which PHP template files will be used to construct a given webpage on your site, based on the type of post content requested: for example, whether the webpage displays a Page, a Post, or an archive of many Posts.So – once we cover the general introduction, we’ll also take a look at how the WordPress template hierarchy works in block themes. However, if you’re using/creating a block-based theme, the WordPress Site Editor gives you a new way to work with templates and the template hierarchy on your site. We’ll start by covering how the WordPress template hierarchy works in general, which applies to all WordPress themes. In fact, the template hierarchy is so important that it gets its own dedicated chapter in our “learn WordPress development course”, Up and Running – it’s now in its revised edition and includes chapters on everything you need to know about WordPress development.īut in this post, you can access all of the important WordPress template hierarchy details for free. By understanding how the template hierarchy works, you can be confident that every page on your site will have the right template. In a nutshell, the template hierarchy determines which template files will be used for each page on your site. If you want to create or customize a WordPress theme, it’s important to understand the WordPress template hierarchy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |