Bird
0
0

Given this child theme functions.php snippet:

medium📝 component behavior Q4 of 15
Wordpress - Theme Structure and Basics
Given this child theme functions.php snippet:
<?php
function child_enqueue() {
  wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
  wp_enqueue_style('child-style', get_stylesheet_uri(), ['parent-style']);
}
add_action('wp_enqueue_scripts', 'child_enqueue');

What will be the result on the website?
AOnly child stylesheet loads, parent stylesheet ignored
BOnly parent stylesheet loads, child stylesheet ignored
CBoth parent and child stylesheets load, child overrides parent styles
DNo stylesheets load due to error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze enqueue order and dependencies

    Parent style is enqueued first, child style depends on parent style.
  2. Step 2: Understand effect on styles

    Both styles load; child styles override parent where conflicts exist.
  3. Final Answer:

    Both parent and child stylesheets load, child overrides parent styles -> Option C
  4. Quick Check:

    Child style depends on parent, both load [OK]
Quick Trick: Enqueue child style with parent as dependency [OK]
Common Mistakes:
MISTAKES
  • Not setting dependency causing wrong load order
  • Forgetting to enqueue child style
  • Using wrong function to get stylesheet URI

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes