Skip to content

Instantly share code, notes, and snippets.

@bgrgicak
Last active November 14, 2024 05:45
Show Gist options
  • Save bgrgicak/6ad8ea2da1e2e79d523ce80c8ae0f98c to your computer and use it in GitHub Desktop.
Save bgrgicak/6ad8ea2da1e2e79d523ce80c8ae0f98c to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Theme Starter Content
Description: Theme Starter Content Example Plugin
Version: 1.0.0
*/
add_action( 'after_setup_theme', function() {
add_theme_support( 'starter-content', array(
'posts' => array(
'homepage-section' => array(
'post_type' => 'page',
'post_title' => _x( 'A homepage section', 'Theme starter content' ),
'post_content' => sprintf(
"<!-- wp:paragraph -->\n<p>%s</p>\n<!-- /wp:paragraph -->",
_x( 'This is an example of a homepage section added by add_theme_support.', 'Theme starter content' )
),
),
),
) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment