wppaste
WordPress

twentytwenty_get_starter_content(): array

Since
Twenty Twenty 1.0
Source
wp-content/themes/twentytwenty/inc/starter-content.php:21
Returns the array of starter content for the theme.

Description

Passes it through the twentytwenty_starter_content filter before returning.

Compatibility

WordPress
since Twenty Twenty 1.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Return value

array
A filtered array of args for the starter_content.

Performance profile

How much work a call to twentytwenty_get_starter_content() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Trivial

Touches nothing outside its own arguments.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
311

Executed per call on PHP 8.5. The body compiles to 311.

Plugin surface
1 hook

Third-party callbacks on 'twentytwenty_starter_content' run inside this call, and their cost is not bounded by anything here.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • hookthird-party callbacksapply_filters()called directly

Further down the call graph this can also reach option, cache, serialize, transient and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 1 distinct outcome

One number would be a lie: the work depends on which branch runs. These are every distinct cost twentytwenty_get_starter_content() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always311_x(), __(), __(), get_theme_file_uri(), __(), __(), __(), get_theme_file_uri(), __(), __(), __(), get_theme_file_uri(), __(), __(), __(), get_theme_file_uri(), __(), __(), __(), get_theme_file_uri(), __(), __(), __(), __(), __(), __(), get_theme_file_uri(), get_theme_file_uri(), get_theme_file_uri(), get_theme_file_uri(), get_theme_file_uri(), __(), __(), __(), apply_filters()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev3113110
8.53113110
8.431131103 fewer instructions than PHP 8.3
8.33143140
8.23143140
8.13143140
7.43143140

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 1

One hook fires while twentytwenty_get_starter_content() runs, in this order:

  1. apply_filters( twentytwenty_starter_content )filterline 216 (+195 into the body)

    Filters Twenty Twenty array of starter content.

Uses · 4

  • _x()Retrieves translated string with gettext context.
  • __()Retrieves the translation of $text.
  • get_theme_file_uri()Retrieves the URL of a file in the theme.
  • apply_filters()Calls the callback functions that have been added to a filter hook.

Used by · 1

Source code

function twentytwenty_get_starter_content() { 	// Define and register starter content to showcase the theme on new sites.	$starter_content = array(		'widgets'     => array(			// Place one core-defined widgets in the first footer widget area.			'sidebar-1' => array(				'text_about',			),			// Place one core-defined widgets in the second footer widget area.			'sidebar-2' => array(				'text_business_info',			),		), 		// Create the custom image attachments used as post thumbnails for pages.		'attachments' => array(			'image-opening' => array(				'post_title' => _x( 'The New UMoMA Opens its Doors', 'Theme starter content', 'twentytwenty' ),				'file'       => 'assets/images/2020-landscape-1.png', // URL relative to the template directory.			),		), 		// Specify the core-defined pages to create and add custom thumbnails to some of them.		'posts'       => array(			'front' => array(				'post_type'    => 'page',				'post_title'   => __( 'The New UMoMA Opens its Doors', 'twentytwenty' ),				// Use the above featured image with the predefined about page.				'thumbnail'    => '{{image-opening}}',				'post_content' => implode(					'',					array(						'<!-- wp:group {"align":"wide"} -->',						'<div class="wp-block-group alignwide"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',						'<h2 class="has-text-align-center">' . __( 'The premier destination for modern art in Northern Sweden. Open from 10 AM to 6 PM every day during the summer months.', 'twentytwenty' ) . '</h2>',						'<!-- /wp:heading --></div></div>',						'<!-- /wp:group -->',						'<!-- wp:columns {"align":"wide"} -->',						'<div class="wp-block-columns alignwide"><!-- wp:column -->',						'<div class="wp-block-column"><!-- wp:group -->',						'<div class="wp-block-group"><div class="wp-block-group__inner-container">',						'<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->',						'<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-1.png" alt="" class="wp-image-37"/></figure>',						'<!-- /wp:image -->',						'<!-- wp:heading {"level":3} -->',						'<h3>' . __( 'Works and Days', 'twentytwenty' ) . '</h3>',						'<!-- /wp:heading -->',						'<!-- wp:paragraph -->',						'<p>' . __( 'August 1 -- December 1', 'twentytwenty' ) . '</p>',						'<!-- /wp:paragraph -->',						'<!-- wp:button {"className":"is-style-outline"} -->',						'<div class="wp-block-button is-style-outline"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Read More', 'twentytwenty' ) . '</a></div>',						'<!-- /wp:button --></div></div>',						'<!-- /wp:group -->',						'<!-- wp:group -->',						'<div class="wp-block-group"><div class="wp-block-group__inner-container">',						'<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->',						'<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-3.png" alt="" class="wp-image-37"/></figure>',						'<!-- /wp:image -->',						'<!-- wp:heading {"level":3} -->',						'<h3>' . __( 'Theatre of Operations', 'twentytwenty' ) . '</h3>',						'<!-- /wp:heading -->',						'<!-- wp:paragraph -->',						'<p>' . __( 'October 1 -- December 1', 'twentytwenty' ) . '</p>',						'<!-- /wp:paragraph -->',						'<!-- wp:button {"className":"is-style-outline"} -->',						'<div class="wp-block-button is-style-outline"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Read More', 'twentytwenty' ) . '</a></div>',						'<!-- /wp:button --></div></div>',						'<!-- /wp:group --></div>',						'<!-- /wp:column -->',						'<!-- wp:column -->',						'<div class="wp-block-column"><!-- wp:group -->',						'<div class="wp-block-group"><div class="wp-block-group__inner-container">',						'<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->',						'<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-2.png" alt="" class="wp-image-37"/></figure>',						'<!-- /wp:image -->',						'<!-- wp:heading {"level":3} -->',						'<h3>' . __( 'The Life I Deserve', 'twentytwenty' ) . '</h3>',						'<!-- /wp:heading -->',

Changelog

Introduced in Twenty Twenty 1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-content/themes/twentytwenty/inc/starter-content.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.