Performance: Custom page templates
MEDIUM IMPACT
Custom page templates affect the initial page load speed and rendering by controlling which PHP and HTML code runs and how many resources are loaded.
<?php /* Template Name: Lightweight Template */ ?> <?php get_header(); ?> <div class="simple-content">Welcome to our landing page!</div> <?php get_footer(); ?>
<?php /* Template Name: Heavy Template */ ?> <?php get_header(); ?> <div><?php echo do_shortcode('[heavy_slider]'); ?></div> <?php get_footer(); ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy template with many shortcodes | Large DOM tree with nested elements | Multiple reflows due to dynamic content | High paint cost from complex styles | [X] Bad |
| Lightweight template with minimal content | Small DOM tree | Single reflow | Low paint cost | [OK] Good |