Template Hierarchy - Wordpress

0

I would like to know in a simple, easy-to-understand way, if anyone can explain about the WP template hierarchy. I have already seen a lot about it, including the image of the documentation, but I have doubts as to how much to use archive.php for example and tals.

If someone has a better explanation about ...

    
asked by anonymous 21.04.2017 / 06:20

1 answer

1

Speak Peter.

As you mentioned, the documentation image already gives a good help. I will make a possible path and you answer with doubts if you have. So, basically just create the files in the folder that Wordpress makes the selection.

The image

Generalrule

Basically,Wordpresswillfollowfromlefttoright,tryingtofindtherighttemplate,accordingtothealternatives.

Let'ssayyouhavea"books I read" tag . So when you type in the address:

  

sitecombr / booksqueli

  • Wordpress will check if what you are looking for is an author, category, custom post, taxonomy, date or tag. In our case it's a tag .
  • Next step is to find out if you have a file in your root directory of the theme called "tag-booksqueli.php" or "tag-tag_id" .
  • If it does not exist, try to find the tag.php file.
  • If you do not find it, Wordpress will try to use the "archive.php" file, if it has pagination, it will use "paged.php" .
  • >
  • If all else fails, Wordpress uses the index.php standard.
  • Using the basic templates

    • archive.php

      Used to display post groups. Example: Latest blog posts.

    • single.php

      Used to display the contents of a post. Example: When the visitor clicks on a post within a list of posts.

    • page.php

      Used to display static pages. Example: View institutional pages like "About Us", "About", "Contact" ...

    • home.php

      Used to view posts from home. If you have set a static page as the home page, the template used will be front-page.php .

    • comments-popup.php

      Used to display the comments of a post, when opened via popup (I think I've never used this template, rs).

    • 404.php

      Used to display specific content when a post is not found.

    • search.php

      Used to display the results of a site search.

    Absss!

        
    25.04.2017 / 00:14