Performance: Why understanding theme files matters
MEDIUM IMPACT
Understanding theme files affects how quickly a WordPress site loads and how smoothly it renders content to users.
<?php get_header(); ?> <?php wp_enqueue_style('theme-style', get_stylesheet_uri()); ?> <?php wp_enqueue_script('theme-script', get_template_directory_uri() . '/js/script.js', [], null, true); ?> <?php get_footer(); ?>
<?php get_header(); ?> <!-- Inline large CSS and JS in header --> <?php get_footer(); ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline large CSS/JS in header | Low | Multiple reflows due to blocking | High paint cost due to delayed styles | [X] Bad |
| Properly enqueued CSS/JS with async/defer | Low | Single reflow after styles load | Lower paint cost with faster style application | [OK] Good |