Як взнати який файл теми використовується
Іноді буває так, що потрібно внести зміни в тему, але складно взнати який саме файл використовується: archive.php category.php а може і index.php
Цей код додайте в functions.php
add_filter( 'template_include', 'var_template_include', 1000 ); function var_template_include( $t ){ $GLOBALS['current_theme_template'] = basename($t); return $t; } function get_current_template( $echo = false ) { if( !isset( $GLOBALS['current_theme_template'] ) ) return false; if( $echo ) echo $GLOBALS['current_theme_template']; else return $GLOBALS['current_theme_template']; }
Для виводу назви файлу (шаблону), додайте цей код, наприклад, в header.php
<?php get_current_template( true ); ?>