Skip to content

Commit

Permalink
chore: adds starter content [closes #18]
Browse files Browse the repository at this point in the history
  • Loading branch information
abaicus committed Dec 8, 2022
1 parent c13e2ed commit cd8044a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
3 changes: 3 additions & 0 deletions inc/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ private function run_hooks() {
public function setup() {
load_theme_textdomain( 'raft', RAFT_DIR . '/languages' );

$starter_content = new Starter_Content();

add_theme_support( 'starter-content', $starter_content->get() );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
Expand Down
67 changes: 67 additions & 0 deletions inc/Starter_Content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* Starter Content Class.
*
* @author Themeisle
* @package raft
* @since 1.0.6
*/

namespace Raft;

/**
* Class Core
*
* @package raft
*/
class Starter_Content {
const HOME_SLUG = 'home';
const BLOG_SLUG = 'blog';

/**
* Get the starter content.
*
* @return array
*/
public function get() {
return array(
'nav_menus' => array(
'primary' => array(
'items' => array(
'home' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{' . self::HOME_SLUG . '}}',
),
'page_blog' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{' . self::BLOG_SLUG . '}}',
),
),
),
),
'options' => array(
'page_on_front' => '{{' . self::HOME_SLUG . '}}',
'page_for_posts' => '{{' . self::BLOG_SLUG . '}}',
'show_on_front' => 'page',
),
'posts' => array(
self::BLOG_SLUG => array(
'post_name' => self::BLOG_SLUG,
'post_type' => 'page',
'post_title' => self::BLOG_SLUG,
),
self::HOME_SLUG => array(
'post_type' => 'page',
'post_title' => self::HOME_SLUG,
'post_content' => '
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<!-- /wp:paragraph -->
',
),
),
);
}
}

0 comments on commit cd8044a

Please sign in to comment.