The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
Dhaka WordPress Meetup 3 - Presentation for Template hierarchy
1. 19 July 2013
WordPress Template
Hierarchy
Presented by
Dhaka WordPress Meetup 3
oneTarek.com
Md Jahidul Islam(oneTarek)
2. The
Question
How can I show different style and layout
for different type pages like Home, Single,
Pages, Category, Tag,
Taxonomy, Attachment etc.
3. The
Answer 1
Hard Way
We can use various conditional tags
to detect what kind of page
has been displayed currently
In header.php we can use
if(is_home())
{load styles and layout for homepage}
elseif(is_single())
{load styles and layout for single page}
And so on..
Some Conditional Tags
is_home(), is_single(), is_page(),is_tag(), is_category(),
is_author(), is_404() and more...
11. front-page.php
This is used for displaying your latest posts or a static page as
defined in Settings > Reading
Front or Home page
3
1
2
Page Display Rules
When you set the Front page in Settings> Reading
Home Page Display Rules
When posts page is set in the Front Page displays section of
Settings> Reading
12. 4
Custom Template File
The page template assigned to the page
<?php
/* Template Name: Whatever you call your template*/
?>
Page Display Rules
page.php
3
1
2
page-{slug}.php
if you use the slug “ bananas” WordPress will look for page-
bananas.php
page-{id}.php
if the page ID is 4, Wordpress looks to use page-4.php
5index.php
15. 4
MIME-type.php
It can be any MIME type ( video.php, image.php, etc) for
text/plain in order:
1.text.php
2.plain.php
3.text_plain.php
Singular Post
single.php
Single Post- Attachment
3
1
2attachment.php
single-attachment.php
5index.php
16. single-{posttype}.php
if post type was “movies”, WordPress would look for
single-movies.php
Singular Post single.php
Single Post- Custom Post
3
1
2 index.php
18. 4
Custom Template File
The page template assigned to the page
<?php
/* Template Name: Whatever you call your template*/
?>
Singular Page
page.php
3
1
2
page-{slug}.php
if you use the slug “ bananas” WordPress will look for page-
bananas.php
page-{id}.php
if the page ID is 4, Wordpress looks to use page-4.php
5index.php
Static page-
aka
“ Page Display Rules”