Syntax
get_template_part( string $slug, string $name = null )
Usage
It includes a template part of the theme. Providing a simple mechanism for child themes to overload reusable sections of code in the theme.
Add the below code in wp-includes/general-template.php.
function get_template_part( $slug, $name = null ) {
do_action( "get_template_part_{$slug}", $slug, $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "{$slug}-{$name}.php";
}
$templates[] = "{$slug}.php";
do_action( 'get_template_part', $slug, $name, $templates );
locate_template( $templates, true, false );
}