{"id":361,"date":"2011-01-12T09:53:57","date_gmt":"2011-01-12T09:53:57","guid":{"rendered":"http:\/\/www.esds.co.in\/data-centers\/kb\/?p=361"},"modified":"2018-01-18T13:20:53","modified_gmt":"2018-01-18T13:20:53","slug":"hierarchy-of-wordpress","status":"publish","type":"post","link":"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/","title":{"rendered":"Files Hierarchy of WordPress in Directory"},"content":{"rendered":"<p><!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } --><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-363\" title=\"wordpress-logo\" src=\"http:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2011\/01\/wordpress-logo.jpg\" alt=\"\" width=\"775\" height=\"100\" \/>WordPress uses a hierarchy of files to create themes. To create good websites and blogs based on WordPress, it is important that you understand this hierarchy.<\/p>\n<p>To create a good theme for WordPress, you need to know well the structure of files that are used in building these themes. Multiple files that are used sectorize the various features of the blog or website.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_77 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#See_below_for_files_that_are_commonly_used\" >See below for files that are commonly used:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#Below_is_a_hierarchy_of_some_files_You_can_see_more_details_here\" >Below is a hierarchy of some files. You can see more details here :<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#A_very_illuminating_diagram_of_WordPress\" >A very illuminating diagram of WordPress :<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"See_below_for_files_that_are_commonly_used\"><\/span><strong>See below for files that are commonly used:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>404 Error Page &#8211; 404.php<\/li>\n<li>History and Archives &#8211; archive.php<\/li>\n<li>Index of History and Archives &#8211; archives.php<\/li>\n<li>Page from a Category &#8211; category.php<\/li>\n<li>Comments &#8211; comments.php<\/li>\n<li>Footer &#8211; footer.php<\/li>\n<li>Header &#8211; header.php<\/li>\n<li>Links &#8211; links.php<\/li>\n<li>Home and Home &#8211; index.php<\/li>\n<li>Pages &#8211; page.php<\/li>\n<li>Post &#8211; single.php<\/li>\n<li>Search Form &#8211; searchform.php<\/li>\n<li>Search results &#8211; search.php<\/li>\n<li>Sidebar &#8211; sidebar.php<\/li>\n<li>Stylesheet &#8211; style.css<\/li>\n<\/ul>\n<p>WordPress uses the Query String of each link on your site to find out which file it should show on the page. It decides what type of page is requested &#8211; a search page, category, etc. home.<\/p>\n<p>It looks for these files within the directory of your template. If WP can not find the requested file, it chooses the default index.php template to be used. There is a hierarchy of template files that WordPress will not order if it finds the correct one.<\/p>\n<p>For example, imagine that your visitor click a link on your site that takes you into a category. WordPress will search the file for the custom category. Suppose that the category ID is 69, it would seek the file category-69.php , which is the file that customizes the page on this category. If it does not find anything, WordPress looks for the file that generates the generic category pages, where the category.php is. However, if it does not find it too, it will seek the archive.php which is the document that generates the pages of history and archives. If it does not find it, it will use the main file index.php.<\/p>\n<p>So, your system \/ blog \/ site is not faulty for not finding a particular document.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Below_is_a_hierarchy_of_some_files_You_can_see_more_details_here\"><\/span><strong>Below is a hierarchy of some files. You can see more details here :<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Home Page<\/strong><\/p>\n<ul>\n<li>home.php<\/li>\n<li>index.php<\/li>\n<\/ul>\n<p><strong>Viewing Post<\/strong><\/p>\n<ul>\n<li>Single.php<\/li>\n<li>index.php<\/li>\n<\/ul>\n<p><strong>Pages<\/strong><\/p>\n<ul>\n<li>nomedapagina.php &#8211; would be a file to specify a custom page<\/li>\n<li>page.php<\/li>\n<li>index.php<\/li>\n<\/ul>\n<p><strong>Category Display<\/strong><\/p>\n<ul>\n<li>category-id.php &#8211; Category specific, where ID is the ID number of the category<\/li>\n<li>category.php<\/li>\n<li>archive.php<\/li>\n<li>index.php<\/li>\n<\/ul>\n<p><strong>History<\/strong><\/p>\n<ul>\n<li>date.php<\/li>\n<li>archive.php<\/li>\n<li>index.php<\/li>\n<\/ul>\n<p><strong>Tag<\/strong><\/p>\n<ul>\n<li>tagslug.php &#8211; Archive customized for a specific tag<\/li>\n<li>tag.php<\/li>\n<li>archive.php<\/li>\n<li>index.php<\/li>\n<li>404<\/li>\n<li>404.php<\/li>\n<li>index.phpc<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"A_very_illuminating_diagram_of_WordPress\"><\/span><strong>A very illuminating diagram of WordPress :<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-362\" title=\"wordpress-hierarchy\" src=\"http:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2011\/01\/wordpress-hierarchy.png\" alt=\"\" width=\"675\" height=\"537\" srcset=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2011\/01\/wordpress-hierarchy.png 880w, https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2011\/01\/wordpress-hierarchy-300x238.png 300w\" sizes=\"(max-width: 675px) 100vw, 675px\" \/><\/p>\n<p>Many developers out there, they advise you to get your theme ready-made. I already go further and suggest you start making the files as they are in need of. So you avoid unnecessary large amount of documents in the folder of your template. This is very important if you&#8217;re making a site, for example. The more organized and the fewer files the better. Still, not jam all the functions in index.php. Divide the sections of the site carefully to avoid confusion in just one file.<\/p>\n<p>You can tell which files you need to use in your template as soon as it receive the documents in HTML. You can use them as a basis for creating the files of templates.<\/p>\n<p>It&#8217;s the best way to start creating a theme from scratch. On the website of WordPress, there is a lot of other important information about Hierarchy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress uses a hierarchy of files to create themes. To create good websites and blogs based on WordPress, it is important that you understand this hierarchy. To create a good theme for WordPress, you need to know well the structure of files that are used in building these themes. Multiple files that are used sectorize [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[152,149,151,150,148],"class_list":["post-361","post","type-post","status-publish","format-standard","hentry","category-general","tag-category-display","tag-home-page","tag-pages","tag-viewing-post","tag-wordpress-hierarchy"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.9.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hierarchy of WordPress | WordPress Hierarchy<\/title>\n<meta name=\"description\" content=\"This KB is about Hierarchy of WordPress including more information about Home Page, Viewing post, Pages, diagram of WordPress and etc.\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hierarchy of WordPress | WordPress Hierarchy\" \/>\n<meta property=\"og:description\" content=\"This KB is about Hierarchy of WordPress including more information about Home Page, Viewing post, Pages, diagram of WordPress and etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"ESDS Official Knowledgebase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ESDSdc\/\" \/>\n<meta property=\"article:published_time\" content=\"2011-01-12T09:53:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-18T13:20:53+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2011\/01\/wordpress-logo.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ESDSDataCenter\" \/>\n<meta name=\"twitter:site\" content=\"@ESDSDataCenter\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"3 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#website\",\"url\":\"https:\/\/www.esds.co.in\/kb\/\",\"name\":\"ESDS Official Knowledgebase\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.esds.co.in\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2011\/01\/wordpress-logo.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#webpage\",\"url\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/\",\"name\":\"Hierarchy of WordPress | WordPress Hierarchy\",\"isPartOf\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#primaryimage\"},\"datePublished\":\"2011-01-12T09:53:57+00:00\",\"dateModified\":\"2018-01-18T13:20:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/#\/schema\/person\/d951a1b6843822458f3c5f5ee02a74e8\"},\"description\":\"This KB is about Hierarchy of WordPress including more information about Home Page, Viewing post, Pages, diagram of WordPress and etc.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/\",\"url\":\"https:\/\/www.esds.co.in\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/\",\"url\":\"https:\/\/www.esds.co.in\/kb\/hierarchy-of-wordpress\/\",\"name\":\"Files Hierarchy of WordPress in Directory\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#\/schema\/person\/d951a1b6843822458f3c5f5ee02a74e8\",\"name\":\"ESDS ADMIN\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/60adc2c4f4d067fa8bb7e682c0fea80e7ee189ca0fe84d805689918516372073?s=96&d=mm&r=g\",\"caption\":\"ESDS ADMIN\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/comments?post=361"}],"version-history":[{"count":13,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":3501,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/361\/revisions\/3501"}],"wp:attachment":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}