Audytor Energetyczny

Codex

Codex tools: Log in
Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!
Post Type Templates
Contents

1 Custom Post Type Templates
2 Examples
2.1 Displaying Custom Taxonomies
2.2 Listing Post Type Pages
2.3 Conditional tags for Custom Post Types
3 Related

Custom Post Type Templates

archive-{post_type}.php
single-{post_type}.php

archive-{post_type}.php
If your custom post type were 'product’, and/or query_var = „product”, WordPress would look for archive-product.php to display the archive of posts.
single-{post_type}.php
If your custom post type were 'product’, and/or query_var = „product”, WordPress would look for single-product.php to display the single or permalink of the post.

If these files are not available in your Theme’s directory WordPress will look for archive.php and single.php, respectively. If even these files are not present it will default to index.php. See Template Hierarchy for more details.
Examples

Make a copy of the single.php or archive.php file as a starting point. That way they will inherit some of the theme’s html structure. Remember to add the post type name to the file ex. archive-post_type.php. From there you may want to customize further…

Newsletter

Zapisz się i bądź na bieżąco

      

    Wyrażam zgodę na przetwarzanie moich danych w celu realizacji usług w ramach Serwisu i akceptuję Politykę Prywatności.

    Wyrażam zgodę na przetwarzanie moich danych w celach marketingowych.

    Sprawdź także naszą ofertę