Опубликовано Оставить комментарий

WordPress TEMPLATE HIERARCHY main page

Template Hierarchy in Codex – https://codex.wordpress.org/Template_Hierarchy
Template Hierarchy – https://developer.wordpress.org/themes/basics/template-hierarchy

Разница между front-page.php page.php home.php index.php
codex – https://developer.wordpress.org/themes/basics/template-hierarchy/#front-page-display

The front-page.php template file is used to render your site’s front page, whether the front page displays the blog posts index (mentioned above) or a static page. The front page template takes precedence over the blog posts index (home.php) template. If the front-page.php file does not exist, WordPress will either use the home.php or page.php files depending on the setup in Settings → Reading. If neither of those files exist, it will use the index.php file.

  1. front-page.php – Used for both “your latest posts” or “a static page” as set in the front page displays section of Settings → Reading.
  2. home.php – If WordPress cannot find front-page.php and “your latest posts” is set in the front page displays section, it will look for home.php. Additionally, WordPress will look for this file when the posts page is set in the front page displays section.
  3. page.php – When “front page” is set in the front page displays section.
  4. index.php – When “your latest posts” is set in the front page displays section but home.php does not exist or when front page is set but page.php does not exist.

Если существует файл front-page.php он будет показываться при вызове главной страницы сайта
Если front-page.php в теме нет
– настройка главной страницы – “Ваши последние записи”, WordPress ищет home.php, если его тоже нет будет вызываться index.php
– настройка главной страницы – “Статическая страница”, WordPress ищет page.php, если его тоже нет будет вызываться index.php

Если front-page.php существует у него максимальный приоритет – он показывается всегда, не смотря на наличие/отсутствие home.php или page.php

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *