0
0
Wordpressframework~10 mins

Template parts in Wordpress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to include a template part named 'header'.

Wordpress
<?php get_[1]('header'); ?>
Drag options to blanks, or click blank then click option'
Atemplate_part_include
Btemplate_part_load
Ctemplate_part
Dtemplate_part_get
Attempts:
3 left
💡 Hint
Common Mistakes
Using functions that do not exist like get_template_part_include.
Confusing with functions that load full templates.
2fill in blank
medium

Complete the code to include a template part named 'content' with a slug 'single'.

Wordpress
<?php get_template_part('content', [1]); ?>
Drag options to blanks, or click blank then click option'
A'single'
B'page'
C'archive'
D'footer'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong slug name that does not match the file.
Omitting quotes around the slug string.
3fill in blank
hard

Fix the error in the code to correctly include the sidebar template part.

Wordpress
<?php get_template_part([1]); ?>
Drag options to blanks, or click blank then click option'
A"sidebar"
B'sidebar'
Csidebar
Dsidebar.php
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the template part name without quotes causing syntax errors.
Including the '.php' extension which is not needed.
4fill in blank
hard

Fill both blanks to include a template part named 'footer' with a slug 'custom'.

Wordpress
<?php get_template_part([1], [2]); ?>
Drag options to blanks, or click blank then click option'
A'footer'
B'header'
C'custom'
D'sidebar'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of arguments.
Using incorrect names that do not match template files.
5fill in blank
hard

Fill all three blanks to include a template part named 'content' with slug 'page' and pass an array of variables.

Wordpress
<?php get_template_part([1], [2], [3]); ?>
Drag options to blanks, or click blank then click option'
A'content'
B'page'
Carray('title' => 'Welcome')
Darray('footer' => true)
Attempts:
3 left
💡 Hint
Common Mistakes
Passing variables as a string instead of an array.
Omitting the third argument when variables are needed.