get_theme_starter_content() – Expands a theme’s starter content configuration using core-provided data.

You appear to be a bot. Output may be restricted

Description

Expands a theme's starter content configuration using core-provided data.

Usage

$array = get_theme_starter_content();

Parameters

Returns

array Array of starter content.

Source

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

201 to 300 of 319

  foreach ( $config as $type => $args ) {
    switch ( $type ) {
      // Use options and theme_mods as-is.
      case 'options':
      case 'theme_mods':
        $content[ $type ] = $config[ $type ];
        break;

      // Widgets are grouped into sidebars.
      case 'widgets':
        foreach ( $config[ $type ] as $sidebar_id => $widgets ) {
          foreach ( $widgets as $id => $widget ) {
            if ( is_array( $widget ) ) {

              // Item extends core content.
              if ( ! empty( $core_content[ $type ][ $id ] ) ) {
                $widget = array(
                  $core_content[ $type ][ $id ][0],
                  array_merge( $core_content[ $type ][ $id ][1], $widget ),
                );
              }

              $content[ $type ][ $sidebar_id ][] = $widget;
            } elseif ( is_string( $widget )
              && ! empty( $core_content[ $type ] )
              && ! empty( $core_content[ $type ][ $widget ] )
            ) {
              $content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ];
            }
          }
        }
        break;

      // And nav menu items are grouped into nav menus.
      case 'nav_menus':
        foreach ( $config[ $type ] as $nav_menu_location => $nav_menu ) {

          // Ensure nav menus get a name.
          if ( empty( $nav_menu['name'] ) ) {
            $nav_menu['name'] = $nav_menu_location;
          }

          $content[ $type ][ $nav_menu_location ]['name'] = $nav_menu['name'];

          foreach ( $nav_menu['items'] as $id => $nav_menu_item ) {
            if ( is_array( $nav_menu_item ) ) {

              // Item extends core content.
              if ( ! empty( $core_content[ $type ][ $id ] ) ) {
                $nav_menu_item = array_merge( $core_content[ $type ][ $id ], $nav_menu_item );
              }

              $content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item;
            } elseif ( is_string( $nav_menu_item )
              && ! empty( $core_content[ $type ] )
              && ! empty( $core_content[ $type ][ $nav_menu_item ] )
            ) {
              $content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ];
            }
          }
        }
        break;

      // Attachments are posts but have special treatment.
      case 'attachments':
        foreach ( $config[ $type ] as $id => $item ) {
          if ( ! empty( $item['file'] ) ) {
            $content[ $type ][ $id ] = $item;
          }
        }
        break;

      /*
			 * All that's left now are posts (besides attachments).
			 * Not a default case for the sake of clarity and future work.
			 */
      case 'posts':
        foreach ( $config[ $type ] as $id => $item ) {
          if ( is_array( $item ) ) {

            // Item extends core content.
            if ( ! empty( $core_content[ $type ][ $id ] ) ) {
              $item = array_merge( $core_content[ $type ][ $id ], $item );
            }

            // Enforce a subset of fields.
            $content[ $type ][ $id ] = wp_array_slice_assoc(
              $item,
              array(
                'post_type',
                'post_title',
                'post_excerpt',
                'post_name',
                'post_content',
                'menu_order',
                'comment_status',
                'thumbnail',
                'template',
              )
 

 View on GitHub View on Trac