Bird
0
0

Which of the following is the correct syntax to enqueue a style named 'custom-style' located in the theme's 'css' folder?

easy📝 Syntax Q3 of 15
Wordpress - Theme Structure and Basics
Which of the following is the correct syntax to enqueue a style named 'custom-style' located in the theme's 'css' folder?
Aenqueue_style('custom-style', '/css/custom-style.css');
Bwp_enqueue_style('custom-style', get_template_directory_uri() . '/css/custom-style.css');
Cwp_enqueue_style('custom-style', '/css/custom-style.css');
Dwp_add_style('custom-style', get_stylesheet_directory() . '/css/custom-style.css');
Step-by-Step Solution
Solution:
  1. Step 1: Use the correct function and path

    Use 'wp_enqueue_style' with 'get_template_directory_uri()' to get the theme URL.
  2. Step 2: Check the syntax correctness

    wp_enqueue_style('custom-style', get_template_directory_uri() . '/css/custom-style.css'); correctly concatenates the URI with the CSS file path.
  3. Final Answer:

    wp_enqueue_style('custom-style', get_template_directory_uri() . '/css/custom-style.css'); -> Option B
  4. Quick Check:

    Correct enqueue syntax = wp_enqueue_style('custom-style', get_template_directory_uri() . '/css/custom-style.css'); [OK]
Quick Trick: Use get_template_directory_uri() for theme URLs [OK]
Common Mistakes:
  • Using wrong function names
  • Using file system path instead of URL
  • Missing concatenation operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes