Ionut Stoica

Programator PHP / Frontend developer / Pasionat de Electronica Auto
31May

Structura corecta a unei teme WordPress

Da, exista si o structura CORECTA pentru realizarea unei teme wordpress. Mai jos voi lista ordinea in care fisierele sunt accesate de catre core-ul wordpress.

is_home():
– home.php -> index.php

is_404():
– 404.php -> index.php

is_search():
– search.php -> index.php

is_archive():
– archive.php -> index.php

is_date():
– date.php -> archive.php -> index.php

is_author():
– author-nicename.php -> author-id.php -> author.php -> archive.php -> index.php

is_category():
– category-slug.php -> category-id.php -> category.php -> archive.php -> index.php

is_tag():
– tag-slug.php -> tag-id.php -> tag.php -> archive.php -> index.php

is_taxonomy():
– taxonomy-taxonomy-term.php -> taxonomy-taxonomy.php -> taxonomy.php -> archive.php -> index.php

is_attachment():
MYME_type.php (image.php,video.php, etc) -> attachment.php -> single.php -> index.php

is_single():
– single-posttype.php -> single.php -> index.php

is_page():
pagename.php -> page-slug.php -> page-id.php -> page.php -> index.php

 

Dupa cum vedeti, toate fisierele au fallback spre index.php, DAR un coder bun nu va folosi niciodata doar index.php pentru ca server-ul verifica toate fisierele de la stanga la dreapta, daca nu exista trece la urmatorul.

Deci pentru pagina numita “test” va cauta mai intai test.php, apoi page-test.php, apoi page-ID.php, unde ID este id-ul acelei pagini, apoi va cauta page.php si abia la final index.php. Asadar, pentru o singura pagina se fac 4 request-uri in cazul in care nu exista nici page.php ci doar index.php

Comments(0)

Leave a comment

Your email address will not be published.Field is required

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

 Previous  All works Next