Apasionado por la tecnología, los proyectos y el liderazgo. Fundador de YAKINDU CIA. LTDA. y SIGHTBOT S.A.S. Ingeniero en Sistemas y Máster en Innovación y Transformación Digital. Soy el CEO de YAKINDU e Ingeniero de Software en Creditú. He liderado varios proyectos tecnológicos para empresas públicas y privadas. Creo que el Ecuador puede transformarse digitalmente para ser mas competitivos y entregar valor al mundo.
Jerarquía de plantillas: diferencias entre index.php, home.php y front-page.php
Jerarquía de plantillas: diferencias entre index.php, home.php y front-page.php

Jerarquía de plantillas: diferencias entre index.php, home.php y front-page.php

home.php is template for posts index (archive of native Post post type, which is a special case in WP). WP will attempt to look it up for index of posts, whether they are displayed at the root of the site or at dedicated posts page.

index.php is catch–all template. It is final choices in all branches of template hierarchy and will be picked when nothing else fits, for both archives and singular views.

Only posts index can use home.php, but all other contexts might and will use index.php.

What’s the ideal condition to use a home.php than an index.php

You use home.php to customize posts index.

You use index.php to provide the most generic template in your theme, suitable for display of anything.

Some themes choose to have empty index.php and ensure they have more specific templates for all possible cases, so it never has to be used.

What’s the ideal condition to use a front-page.php?

front-page.php is used for posts index at the root or static front page, if enabled.

It is a high priority template, so if theme has it you cannot select arbitrary template for static front page. For this reason it is almost never included in publicly released themes (which is correct).

The best use for it is in private projects, since it’s easier to configure than page template.

When I’m using a front-page.php then what specific task an index.php is doing for me then?

index.php is still a catch all template for all other cases.

If you use static front page (to which front-page.php will apply) then your posts page will try to use home.php and then index.php.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *