Bird
0
0

You want to add a custom image size in your theme using functions.php. Which code correctly adds a new image size named 'custom-thumb' with 300x200 pixels and hard crop?

hard📝 Application Q8 of 15
Wordpress - Theme Structure and Basics
You want to add a custom image size in your theme using functions.php. Which code correctly adds a new image size named 'custom-thumb' with 300x200 pixels and hard crop?
Aadd_image_size('custom-thumb', 300, 200, true);
Badd_image_size('custom-thumb', 300, 200, false);
Cregister_image_size('custom-thumb', 300, 200, true);
Dset_image_size('custom-thumb', 300, 200, true);
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct function to add image sizes

    The WordPress function to add image sizes is add_image_size.
  2. Step 2: Understand parameters for hard crop

    The fourth parameter set to true enables hard cropping to exact dimensions.
  3. Final Answer:

    add_image_size('custom-thumb', 300, 200, true); -> Option A
  4. Quick Check:

    Use add_image_size with true for hard crop [OK]
Quick Trick: Use add_image_size(name, width, height, true) for hard crop [OK]
Common Mistakes:
  • Using wrong function names like register_image_size
  • Setting crop parameter to false for hard crop

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes