Complete the code to load the main template file in WordPress.
get_template_part('[1]');
The get_template_part('index') function loads the main template file named index.php in WordPress.
Complete the code to load the template for a single post in WordPress.
get_template_part('[1]');
The single.php template is used to display individual posts. Using get_template_part('single') loads this template part.
Fix the error in the code to load the category template correctly.
get_template_part('[1]');
The correct template part for category archives is category.php. So, get_template_part('category') loads it properly.
Fill both blanks to create a conditional that loads the author template only on author archive pages.
if (is_[1]()) { get_template_part('[2]'); }
is_archive() which is more general and not specific to authors.The function is_author() checks if the page is an author archive. The template part author.php is loaded with get_template_part('author').
Fill all three blanks to create a custom loop that loads the content template only for posts in the 'news' category.
if (have_posts()) { while (have_posts()) { the_post(); if (in_category('[1]')) { get_template_part('[2]', '[3]'); } } }
get_template_part for variations.This code checks if posts belong to the 'news' category using in_category('news'). It then loads the content-single.php template part with get_template_part('content', 'single').