is_main_query()) { return; }
if ($query->is_home()) {
// Homepage is showing posts
$uploads = wp_upload_dir();
$file = trailingslashit($uploads[‘basedir’]) . ‘dmf-home/home.html’;
if (file_exists($file)) {
// Stop normal post query
$query->set(‘posts_per_page’, -1);
$query->set(‘paged’, 0);
// We’ll handle display in template_redirect
add_action(‘template_redirect’, function() {
$uploads = wp_upload_dir();
$file = trailingslashit($uploads[‘basedir’]) . ‘dmf-home/home.html’;
if (!file_exists($file)) { return; }
$base = untrailingslashit($uploads[‘baseurl’]) . ‘/dmf-home’;
$html = str_replace(‘{{ASSET_BASE}}’, $base, file_get_contents($file));
nocache_headers();
header(‘Content-Type: text/html; charset=utf-8’);
echo $html;
exit;
}, 0);
}
}
}, 10);