Complete the code to register a custom theme in WordPress.
function my_theme_setup() {
add_theme_support('[1]');
}
add_action('after_setup_theme', 'my_theme_setup');The post-thumbnails feature enables featured images, giving you control over post visuals in your custom theme.
Complete the code to enqueue a custom stylesheet in your theme.
function my_theme_scripts() {
wp_enqueue_style('custom-style', get_template_directory_uri() . '/[1]');
}
add_action('wp_enqueue_scripts', 'my_theme_scripts');The style.css file is the main stylesheet for a WordPress theme, so enqueueing it applies your custom styles.
Fix the error in the code to properly register a navigation menu.
function register_my_menu() {
register_nav_menu('[1]', __('Primary Menu'));
}
add_action('init', 'register_my_menu');The header-menu is a common location name for the primary navigation menu in themes, matching WordPress conventions.
Fill both blanks to create a custom loop that shows 5 latest posts.
<?php $args = array( 'post_type' => '[1]', 'posts_per_page' => [2] ); $query = new WP_Query($args); ?>
Using post as the post type and 5 for posts per page fetches the latest 5 blog posts.
Fill both blanks to display the post title linked to its permalink inside a loop.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h2><a href="<?php [1](); ?>"><?php [2](); ?></a></h2> <?php endwhile; endif; ?>
the_permalink() outputs the URL for the post link, and the_title() outputs the post title. get_permalink() can be used to get the URL if needed.