0
0
Wordpressframework~10 mins

Why custom themes offer full control in Wordpress - Test Your Understanding

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

Complete the code to register a custom theme in WordPress.

Wordpress
function my_theme_setup() {
  add_theme_support('[1]');
}
add_action('after_setup_theme', 'my_theme_setup');
Drag options to blanks, or click blank then click option'
Apost-thumbnails
Bcustom-logo
Cwidgets
Dmenus
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a feature unrelated to images like 'widgets' or 'menus'.
2fill in blank
medium

Complete the code to enqueue a custom stylesheet in your theme.

Wordpress
function my_theme_scripts() {
  wp_enqueue_style('custom-style', get_template_directory_uri() . '/[1]');
}
add_action('wp_enqueue_scripts', 'my_theme_scripts');
Drag options to blanks, or click blank then click option'
Astyle.css
Bscript.js
Cfunctions.php
Dindex.php
Attempts:
3 left
💡 Hint
Common Mistakes
Using JavaScript or PHP files instead of CSS for styles.
3fill in blank
hard

Fix the error in the code to properly register a navigation menu.

Wordpress
function register_my_menu() {
  register_nav_menu('[1]', __('Primary Menu'));
}
add_action('init', 'register_my_menu');
Drag options to blanks, or click blank then click option'
Asidebar-menu
Bfooter-menu
Cheader-menu
Dmain-menu
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated menu location names that don't match theme areas.
4fill in blank
hard

Fill both blanks to create a custom loop that shows 5 latest posts.

Wordpress
<?php
$args = array(
  'post_type' => '[1]',
  'posts_per_page' => [2]
);
$query = new WP_Query($args);
?>
Drag options to blanks, or click blank then click option'
Apost
Bpage
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'page' instead of 'post' or wrong number of posts.
5fill in blank
hard

Fill both blanks to display the post title linked to its permalink inside a loop.

Wordpress
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  <h2><a href="<?php [1](); ?>"><?php [2](); ?></a></h2>
<?php endwhile; endif; ?>
Drag options to blanks, or click blank then click option'
Athe_permalink
Bthe_title
Cget_permalink
Dget_the_title
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing functions that return values instead of echoing them.