-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import a stand-alone starter content file (#82)
- Write the content of the file starter-content.php into the plugin directory - Active the plugin - Use the "importThemeStarterContent" step. - User lands on home page and can see the starter content on the "Our Subscriptions" page. ![Screenshot 2024-11-27 at 17 15 37](https://github.com/user-attachments/assets/40dcd4b2-9fbe-4c16-875b-b93861c6c025) Thank you to @bgrgicak + @juanmaguitar for inspiration. Thank you to @zaerl for reviews
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$schema": "https://playground.wordpress.net/blueprint-schema.json", | ||
"meta": { | ||
"title": "Import a standalone starter content via a blueprint step", | ||
"author": "bph", | ||
"description": "Blueprint to use a stand-alone starter content file and then to import it. Click on 'Subscriptions'", | ||
"categories": ["Themes", "Starter Content"] | ||
}, | ||
"landingPage": "/", | ||
"features": { | ||
"networking": true | ||
}, | ||
"steps": [ | ||
{ | ||
"step": "writeFile", | ||
"path": "/wordpress/wp-content/plugins/starter-content.php", | ||
"data": { | ||
"resource": "url", | ||
"url": "https://raw.githubusercontent.com/wordpress/blueprints/filestartercontent/blueprints/file-starter-content/startercontent.php" | ||
} | ||
}, | ||
{ | ||
"step": "activatePlugin", | ||
"pluginPath": "/wordpress/wp-content/plugins/starter-content.php" | ||
}, | ||
{ | ||
"step": "importThemeStarterContent" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/* | ||
Plugin Name: Short Starter Content Example | ||
Description: This plugin adds a starter content to a Playground instance. Used as part of a Playground Blueprint example. | ||
Author: Birgit Pauli-Haack | ||
Version: 0.0.1 | ||
*/ | ||
/** | ||
* To learn more about Starter Content for Themes read: https://make.wordpress.org/core/2016/11/30/starter-content-for-themes-in-4-7/ | ||
*/ | ||
add_action( 'after_setup_theme', function() { | ||
add_theme_support( 'starter-content', array( | ||
'posts' => array( | ||
'homepage-section' => array( | ||
'post_type' => 'page', | ||
'post_title' => _x( 'Our Subscriptions', 'Theme starter content', 'your-text-domain' ), | ||
'post_content' => '<!-- wp:group {"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"><!-- wp:heading {"textAlign":"center"} --> | ||
<!-- /wp:heading --> | ||
<!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"1.125rem"},"spacing":{"margin":{"top":"var:preset|spacing|10"}}}} --> | ||
<p class="has-text-align-center" style="margin-top:var(--wp--preset--spacing--10);font-size:1.125rem">We offer two subscription levels: </p> | ||
<!-- /wp:paragraph --> | ||
<!-- wp:list --> | ||
<ul class="wp-block-list"><!-- wp:list-item --> | ||
<li><strong><em>Free</em> at $0</strong> - Access to 5 exclusive <em>Études Articles</em> per month.</li> | ||
<!-- /wp:list-item --> | ||
<!-- wp:list-item --> | ||
<li><strong><em>Connoisseur</em> at $12</strong> - Access to 20 exclusive <em>Études Articles</em> per month.<br></li> | ||
<!-- /wp:list-item --></ul> | ||
<!-- /wp:list --></div> | ||
<!-- /wp:group -->' | ||
), | ||
), | ||
) ); | ||
} ); |