Recall & Review
beginner
What is a shortcode in WordPress?
A shortcode is a simple code wrapped in square brackets that you can add to posts or pages to insert dynamic content without writing full code.
Click to reveal answer
beginner
How do parameters work in WordPress shortcodes?
Parameters let you customize the shortcode output by passing extra information inside the shortcode, like [gallery size="medium"].Click to reveal answer
beginner
Example: What does this shortcode do? [button color="red" size="large"]Click me[/button]
It creates a button with red color and large size. The parameters 'color' and 'size' change how the button looks.
Click to reveal answer
intermediate
How do you define a shortcode with parameters in PHP?
You create a function that accepts attributes as an array, use shortcode_atts() to set defaults, then register it with add_shortcode().
Click to reveal answer
intermediate
Why use shortcode_atts() in shortcode functions?
It sets default values for parameters and merges them with user input, so your shortcode always has valid data to work with.
Click to reveal answer
What symbol wraps a WordPress shortcode?
✗ Incorrect
Shortcodes are always wrapped in square brackets like [shortcode].
How do you pass parameters to a shortcode?
✗ Incorrect
Parameters go inside the shortcode tag as key="value" pairs.
Which function helps set default parameter values in shortcode functions?
✗ Incorrect
shortcode_atts() merges user parameters with defaults.
What does add_shortcode() do?
✗ Incorrect
add_shortcode() tells WordPress what function to run for a shortcode.
If a shortcode has [button color="blue"], what is 'color'?
✗ Incorrect
'color' is a parameter passed to the shortcode to change its output.
Explain how to create a WordPress shortcode that accepts parameters and uses default values.
Think about how to handle missing parameters and connect the shortcode name to the function.
You got /4 concepts.
Describe how parameters inside a shortcode affect its behavior and give a simple example.
Imagine changing the color or size of a button using parameters.
You got /4 concepts.