_resolve_home_block_template() – Returns the correct template for the site’s home page.

You appear to be a bot. Output may be restricted

Description

Returns the correct template for the site's home page.

Usage

$array|null = _resolve_home_block_template();

Parameters

Returns

array|null A template object, or null if none could be found.

Source

File name: wordpress/wp-includes/block-template.php
Lines:

1 to 23 of 23
function _resolve_home_block_template() {
  $show_on_front = get_option( 'show_on_front' );
  $front_page_id = get_option( 'page_on_front' );

  if ( 'page' === $show_on_front && $front_page_id ) {
    return array(
      'postType' => 'page',
      'postId'   => $front_page_id,
    );
  }

  $hierarchy = array( 'front-page', 'home', 'index' );
  $template  = resolve_block_template( 'home', $hierarchy, '' );

  if ( ! $template ) {
    return null;
  }

  return array(
    'postType' => 'wp_template',
    'postId'   => $template->id,
  );
}
 

 View on GitHub View on Trac