Exercise 2: Why the_post_thumbnail()'s Automatic Dimensions Matter Here — Possible Solution ==================================================================== WHAT the_post_thumbnail() ACTUALLY DOES ------------------------------ It's WordPress's own built-in template function for outputting a post's featured image, and per this chapter's own inline comment, it "preserves width/height automatically" - meaning the HTML it outputs already includes explicit width and height attributes on the resulting tag, without the theme developer needing to add them manually. WHY THIS MATTERS, PER CHAPTER 9's OWN CLS MATERIAL ------------------------------ Per Chapter 9, "WordPress automatically outputs explicit width and height attributes on images in most standard contexts - a real, built-in CLS protection, since the browser can reserve the correct space before the image finishes loading," and "a common mistake in custom theme development is stripping these attributes out... reintroducing the exact layout-shift risk WordPress's own defaults were already preventing." Using the_post_thumbnail() rather than hand-writing custom image-output code (which could easily and unintentionally omit these attributes) means this capstone automatically inherits that existing CLS protection rather than risking reintroducing the exact mistake Chapter 9 specifically warned against. WHY THIS IS CALLED OUT DELIBERATELY IN THIS CHAPTER ------------------------------ The inline comment specifically draws attention to this because it would be easy to overlook - the archive-project.php template could just as easily have used a hand-rolled tag pulling the image URL directly, which is precisely the kind of custom code Chapter 9 warned tends to accidentally drop these attributes. Choosing the_post_thumbnail() instead is a deliberate, correct decision, not an accident - and this chapter makes that choice visible rather than letting it pass silently. WHY THIS MATTERS FOR THE CAPSTONE'S OWN CHAPTER 9 ATTRIBUTION ------------------------------ Per this chapter's own attribution table, "preserved thumbnail dimensions, footer-loaded scripts" is explicitly credited to Chapter 9. The specific choice to use the_post_thumbnail() rather than a hand-written image tag is exactly what earns that attribution - it's the concrete implementation decision in this capstone that actually delivers on Chapter 9's own CLS-prevention lesson, not just a coincidental resemblance. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains precisely what the_post_thumbnail() does differently from a hand-written alternative, connects that difference directly to Chapter 9's own CLS warning about custom image code, and explains why this specific implementation choice is what the capstone's own attribution table is crediting.