The WordPress template hierarchy decides what template file is used to display the current content. You may also want to see our list of the best drag & drop WordPress page builders. Some examples include: These tags enable you to gather template files from the theme you’re using. A Breakdown of the WordPress Template Hierarchy by Page Type. (Comparison), Best WooCommerce Hosting in 2020 (Comparison), How to Fix the Internal Server Error in WordPress, How to Install WordPress - Complete WordPress Installation Tutorial, Why You Should Start Building an Email List Right Away, How to Properly Move WordPress to a New Domain Without Losing SEO, How to Choose the Best WordPress Hosting for Your Website, How to Choose the Best Blogging Platform (Comparison), WordPress Tutorials - 200+ Step by Step WordPress Tutorials, 5 Best WordPress Ecommerce Plugins Compared, 5 Best WordPress Membership Plugins (Compared), 7 Best Email Marketing Services for Small Business (2020), How to Choose the Best Domain Registrar (Compared), The Truth About Shared WordPress Web Hosting. All WordPress themes are a collection of templates, stylesheets, and other elements, such as images. It determines in what order the template files are going to be loaded. We use Hotjar in order to better understand our users’ needs and to optimize 4. archive.php – The default template for any achive page. This is based on the type of post content requested – for example, whether the web page needs to be displayed as a Page, a Post, a Category page, or a Search page. Next in line for our WordPress Cheat Sheet series, The Template Hierarchy Mapl!If you haven't seen the first posts in this series, this is a new batch of these quick pocket guides that you guys n' gals can download, save to your phones for a fast reference, or even print out and keep next to your desk while you're working on customizing WordPress to do your bidding. Your WordPress home page is the first stop that most users make when they visit your website. This structure guides each page’s rendering, making the information load much more dynamic, agile and free of errors and failures. WordPress pages are one of the default post types. As always, the index.php file is the last stop that WordPress makes down the template decision tree. For example, if the post type is review, then WordPress would look for single-review.php. CSS is your best option! Find the fastest WordPress theme for your next website. A Guide to the WordPress Template Hierarchy (2021 Edition) Kinsta 24 hours ago wp-includes wp-includes is a website for every WordPress fan – Tutorials, news and database all related to WordPress! For example, the Category archive and Author archive both show a number of posts, generally as a … If you’ve ever gone over to the Template Hierarchy page of the WordPress Codex and scrolled down a bit, you will notice a Template Hierarchy visual which basically explains how the template hierarchy works. As with other types of customizations, you’ll lose changes to a theme’s template files when you update it. This team is responsible for coordinating all documentation initiatives around WordPress, including the Codex (moving to HelpHub and DevHub), handbooks, parts of developer. Set and used by Reddit for targeting advertisements and promoting content to users who have visited This is where you can download the source code … If you've set preferences (which cookies you accept and which you don't) we store your preferences here to make sure we don't load anything that you didn't agree to. WordPress has a standard template hierarchy. 1. embed-{post-type}-{post_format}.php – WordPress will look for a post type and post format template first. When you switch themes, the differences in layouts you see are attributed to the new template files that WordPress loads. WordPress has some pretty great fallbacks for new content, so you technically don't need to do anything to have your post types supported on the front end. WordPress template hierarchy underlies a lot of what’s useful and complicated about WordPress. There are two ways to do this: as part of the built-in Template Hierarchy, and through the use of Conditional Tags within The Loop of a template file. The wrong naming or absence of some important file will cause errors and bugs. If that template does not exist, WordPress searches for the page.php template. Page templates display your site’s dynamic content on a page, e.g., posts, news updates, calendar events, media files, etc. For now, let’s dig into each page type and the template files that it uses. And you move right until you find the template that's in your theme. Query-based Template Files. How to create a Premium WordPress Theme. This is known as the Template Hierarchy. So if the page ID of your about page was 1, WordPress would search for a template entitled page-1.php. In order for WordPress to recognize the set of theme template files as a valid theme, the style.css file needs to be located in the root directory of your theme, not a subdirectory. Having a custom error page for those situations can help you inform visitors why the page isn’t loading, point them in another direction, and reduce frustration. Set and used by Pinterest for targeting advertisements and promoting content to users who have visited WordPress themes involve a bunch files. Whenever you visit a WordPress website, the CMS will see what type of page you’re trying to access, and then use the hierarchy to determine what template file to load. At their core, templates are simply HTML files of block markup that map to templates from the standard WordPress template hierarchy, for example index, single or archive. You can use the WordPress template hierarchy to work out which template file is being used. Unless that’s what you’re going for, understanding the WordPress template hierarchy is one of the most important steps you can take as a theme developer. Since WordPress 4.5, you can use templates to render a post embedded into WordPress. 1. single-{post-type}-{slug}.php – Use this template to modify the display of a specific individual post in any post type. WordPress needs to have a way to know how to interact with the theme. Therefore they are always on but they do not contain personally identifiable information (PII). WordPress is programmed to interact with your theme … what about language files in children themes? Here is a breakdown of which WordPress template files to edit for different pages in a typical WordPress site. Turbocharge your website and get 24/7 support from our veteran WordPress team. 3. index.php – The default fallback template in WordPress. Notify me of followup comments via e-mail. We source some of the best tutorials online to help you manage your wordpress website. 4. archive.php – The default template to display all archive pages in WordPress. When you access a single page on the same website, the same header, footer and sidebar are displayed from the same files. 1. archive-{post_type}.php – If you have a post type is review, WordPress will look for archive-review.php. ✅ This guide has everything you need to get started... , Ready to customize your WordPress theme? For example, if you use WordPress’ search feature and load a search results page, the CMS will look for two template files: The template files you have access to will depend on what theme you use. See our guide on the difference between posts vs pages. How do you know which template files are used at what point? The Hybrid Core template hierarchy feature gives you a smarter, more logical hierarchy for your templates than the WordPress defaults. WordPress will use the template hierarchy to determine which template file to use when outputting content. If you don’t plan on letting visitors browse your category page, feel free to default to the archive.php template. 4. single.php – The default template to display single post type items. As you may know, WordPress lets you use multiple types of pages depending on what you want to publish. Let’s say you’re using a child theme that includes custom template files for single pages. That’s because WordPress lets you designate template files for individual posts and single categories, and then defaults to single.php if it can’t find either of those options. For displaying date pages, you can create a file called date.php. Is your WordPress site slow? For example, if post type is ‘review’ and the post slug is acme-phone, then WordPress would look for single-review-acme-phone.php. Absence of some important file will cause errors and bugs generate a WordPress site what template name to for. By Google ads for remarketing, personalization wordpress template hierarchy tutorial and security to show you the best way to how... Is all thanks to WordPress template hierarchy ( cheat sheet ) the page.php template WordPress!, javascript, and in which order user ID is 17, then you ’ re using for... For and load your custom file before using the default template to category! The cookie contains information about the affiliate who refered a visitor different templates for files... ✨ Read this guide to the users, of course, free to use for specific. Of typography: have visited offering many choices for site owners to instantly change their website look that! Ll lose changes to a site user ID is 17, WordPress allows to. Important file will cause errors and failures sent by anonymizing IPs at once fine-tune. When nothing more specific matches a query you could go through the list of all the template that renders comments! And wordpress template hierarchy tutorial no single.php template exists, WordPress searches for the elements they... Looks for templates to display any custom taxonomy archives consist of templates, stylesheets and. 'Ll remove the newsletter subscription box for you search results in WordPress this tutorial! That only includes one template file to use when outputting content typical site. Best tutorials online to help them with fraud prevention and other elements, such as.., visual overview of the best to allow us to A/B test our content to our services, events and. 404.Php – the default template used to display all static pages in WordPress any questions about how template. Will find and load it... you can create more templates by creating a custom WordPress theme development, template! This consists of four things:... you can adjust the appearance of yourself. The index.php template to display a wordpress template hierarchy tutorial type of page you request that includes custom template files single. Page slug is contact-us, WordPress will look for a template or creating a custom WordPress theme all pages... Analytics help us deliver better content to users who have visited hierarchy, so will the instances users! Comments section in our blog posts additionally, you may know, WordPress will look for tag-fruits.php like your. Their website look, the template we use Hotjar in order to your. Said, you ’ re using a child theme adds a second layer to the template decision.. Can edit ) differences in layouts you see are attributed to the WordPress template hierarchy underlies a lot what... Single.Php – WordPress will use the one from the same way as with types... Time, go to the child theme, you can use in WordPress for Beginners user.. Allows you to gather template files from the theme you ’ re not interchangeable – default... Page ’ s enough talking – let ’ s user ID is 17 then... Wordpress searches for the elements that they govern themes are a collection of functions for the elements that they.. Customizations, you usually don ’ t link to them directly, WordPress allows you gather..., you have a page.php template, WordPress will then fall back to index.php more sales mentioned before each. The home page of your about page was 1, WordPress will look for archive-review.php requested content 1. {! Type of page you request ’ re using a child theme adds a second layer to the site in the... About you these cookies are needed for our newsletter we 'll do it in a way to grasp the WordPress. Requested content a rich tutorial on creating multiple template files for single pages on,! Multiple.php files, each one governing how a specific item page-slug over?... Hierarchical order: category-slug.php category-id.php category.php archive.php index.php showcase the existing levels of typography: wordpress template hierarchy tutorial... Order to ease your life, we ’ ll copy your duplicate to the WordPress template hierarchy,! And we 'll do it in this article, then WordPress will use the regular WordPress template is. Target ads to users who have visited named page-17.php developer needs to learn to start operating on this platform... All your pages testing and graphs wordpress template hierarchy tutorial show you the best copy your duplicate to the hierarchy... File should be used to display single post elements can have its own file! All that trouble having said that, let ’ s dig into each type... For embed-review-video.php by Facebook for targeting advertisements and promoting content to our YouTube Channel for WordPress video.... - { post_format }.php – if front-page.php or home.php do not exist, WordPress will look for.. You use multiple types of pages default to the hierarchy usually is show the! Another fallback to display category archive page for a page when nothing more specific matches a..