WP_Theme_JSON::get_template_parts() – Returns the template part data of current theme.

You appear to be a bot. Output may be restricted

Description

Returns the template part data of active theme.

Usage

$array = WP_Theme_JSON::get_template_parts();

Parameters

Returns

array

Source

File name: wordpress/wp-includes/class-wp-theme-json.php
Lines:

1 to 16 of 16
  public function get_template_parts() {
    $template_parts = array();
    if ( ! isset( $this->theme_json['templateParts'] ) || ! is_array( $this->theme_json['templateParts'] ) ) {
      return $template_parts;
    }

    foreach ( $this->theme_json['templateParts'] as $item ) {
      if ( isset( $item['name'] ) ) {
        $template_parts[ $item['name'] ] = array(
          'title' => isset( $item['title'] ) ? $item['title'] : '',
          'area'  => isset( $item['area'] ) ? $item['area'] : '',
        );
      }
    }
    return $template_parts;
  }
 

 View on GitHub View on Trac