Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New example: Install theme from a directory inside a GitHub repo #66

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cc7bc90
added error log messages
juanmaguitar Aug 1, 2024
4d0c681
install debug log manager
juanmaguitar Aug 1, 2024
a9f1688
cleaned spaces
juanmaguitar Aug 1, 2024
c91169f
fixed space issue
juanmaguitar Aug 1, 2024
2ff405a
fixed PHP
juanmaguitar Aug 1, 2024
ce91e9a
better log messages
juanmaguitar Aug 1, 2024
36bd968
fixed lenght array errors
juanmaguitar Aug 1, 2024
23aa320
prevent no content errors
juanmaguitar Aug 1, 2024
71aa266
added comments to track snippets of code
juanmaguitar Aug 1, 2024
48e8729
require wp-load always
juanmaguitar Aug 1, 2024
5d8f647
updated error logs
juanmaguitar Aug 1, 2024
549fd40
updated starter content
juanmaguitar Aug 1, 2024
4dba3f6
created function
juanmaguitar Aug 1, 2024
6a7318a
removed functions
juanmaguitar Aug 1, 2024
1bea990
import funtion as mu-plugin
juanmaguitar Aug 1, 2024
49bd8c7
removed semicolons after comments
juanmaguitar Aug 1, 2024
713c536
fixed url log-content-state.php
juanmaguitar Aug 1, 2024
2906f97
added namespace
juanmaguitar Aug 1, 2024
53c1b0f
different mu-plugin approach
juanmaguitar Aug 1, 2024
f5bb1ac
wp-load required
juanmaguitar Aug 1, 2024
d305699
added wpide plugin
juanmaguitar Aug 1, 2024
5a94be0
improved comments PHP
juanmaguitar Aug 1, 2024
3d50e42
removed wpide plugin
juanmaguitar Aug 1, 2024
030b6c0
updated categories and removed php file
juanmaguitar Aug 1, 2024
ba58af2
added with logs to title
juanmaguitar Aug 1, 2024
4e6ad4c
new example of installing a theme from a GitHub repository
juanmaguitar Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions blueprints/install-theme-from-directory-repo/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"meta": {
"title": "Install theme from a GitHub repo",
"description": "It installs a theme from a directory inside a GitHub repo.",
"author": "juanmaguitar",
"categories": ["theme", "repository", "test"]
},
"landingPage": "/wp-admin/post.php",
"preferredVersions": {
"php": "8.0",
"wp": "beta"
},
"features": {
"networking": true
},
"login": true,
"steps": [
{
"step": "installTheme",
"themeZipFile": {
"resource": "url",
"url": "https://github-proxy.com/proxy/?repo=Automattic/themes&branch=trunk&directory=assembler"
},
"options": {
"activate": true
}
}
]
}
32 changes: 28 additions & 4 deletions blueprints/reset-data-and-import-content/blueprint.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"meta": {
"title": "Reset data",
"description": "It gets a WordPress installation without any content",
"title": "Reset data and import content (with logs)",
"description": "It resets default data before importing custom content. It also logs the state of the content after each step.",
"author": "juanmaguitar",
"categories": ["reset"]
"categories": ["reset", "log", "debug", "debug", "import", "content"]
},
"landingPage": "/wp-admin",
"landingPage": "/wp-admin/edit.php",
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "writeFile",
"path": "/wordpress/wp-content/mu-plugins/log_content_state.php",
"data": "<?php /* log_content_state() definition */ namespace MyPlayground\\Utils\\Debug; require '/wordpress/wp-load.php'; function log_content_state($message) { $args = ['post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1]; $posts = get_posts($args); error_log($message); if (!empty($posts)) { $last_post = $posts[count($posts) - 1]; error_log(count($posts) . ' posts - Last Post title: ' . $last_post->post_title); } else { error_log('No posts found'); } }"
},
{
"step": "runPHP",
"code": "<?php /* Log state content by default */ require '/wordpress/wp-load.php'; MyPlayground\\Utils\\Debug\\log_content_state('Last post by default');"
},
{
"step": "resetData"
},
{
"step": "runPHP",
"code": "<?php /* Log state content after resetData */ require '/wordpress/wp-load.php'; MyPlayground\\Utils\\Debug\\log_content_state('Last post after resetData');"
},
{
"step": "importWxr",
"file": {
"resource": "url",
"url": "https://raw.githubusercontent.com/wordpress-juanmaguitar/blueprints/trunk/blueprints/reset-data-and-import-content/starter-content.xml"
}
},
{
"step": "runPHP",
"code": "<?php /* Log state content after importWxr */ require '/wordpress/wp-load.php'; MyPlayground\\Utils\\Debug\\log_content_state('Last post after importWxr');"
}
]
}
98 changes: 98 additions & 0 deletions blueprints/reset-data-and-import-content/starter-content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->

<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!-- on the site. For each author, you may choose to map to an -->
<!-- existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!-- contained in this file into your site. -->

<!-- generator="WordPress/6.5.4" created="2024-06-10 12:29" -->
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.2/">

<channel>
<title>My WordPress Website</title>
<link>https://playground.wordpress.net/scope:0.1608808646050726</link>
<description></description>
<pubDate>Mon, 10 Jun 2024 12:29:10 +0000</pubDate>
<language>en-US</language>
<wp:wxr_version>1.2</wp:wxr_version>
<wp:base_site_url>https://playground.wordpress.net/scope:0.1608808646050726</wp:base_site_url>
<wp:base_blog_url>https://playground.wordpress.net/scope:0.1608808646050726</wp:base_blog_url>

<wp:author>
<wp:author_id>1</wp:author_id>
<wp:author_login><![CDATA[admin]]></wp:author_login>
<wp:author_email><![CDATA[admin@localhost.com]]></wp:author_email>
<wp:author_display_name><![CDATA[admin]]></wp:author_display_name>
<wp:author_first_name><![CDATA[]]></wp:author_first_name>
<wp:author_last_name><![CDATA[]]></wp:author_last_name>
</wp:author>


<generator>https://wordpress.org/?v=6.5.4</generator>

<item>
<title><![CDATA["The Road Not Taken" by Robert Frost]]></title>
<link>https://playground.wordpress.net/scope:0.1608808646050726/?p=1</link>
<pubDate>Wed, 05 Jun 2024 16:04:48 +0000</pubDate>
<dc:creator><![CDATA[admin]]></dc:creator>
<guid isPermaLink="false">http://127.0.0.1:9400/?p=1</guid>
<description></description>
<content:encoded><![CDATA[<!-- wp:paragraph -->
<p>Two roads diverged in a yellow wood,<br>And sorry I could not travel both<br>And be one traveler, long I stood<br>And looked down one as far as I could<br>To where it bent in the undergrowth;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Then took the other, as just as fair,<br>And having perhaps the better claim,<br>Because it was grassy and wanted wear;<br>Though as for that the passing there<br>Had worn them really about the same,</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>And both that morning equally lay<br>In leaves no step had trodden black.<br>Oh, I kept the first for another day!<br>Yet knowing how way leads on to way,<br>I doubted if I should ever come back.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I shall be telling this with a sigh<br>Somewhere ages and ages hence:<br>Two roads diverged in a wood, and I—<br>I took the one less traveled by,<br>And that has made all the difference.</p>
<!-- /wp:paragraph -->]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>10</wp:post_id>
<wp:post_date><![CDATA[2024-06-05 16:04:48]]></wp:post_date>
<wp:post_date_gmt><![CDATA[2024-06-05 16:04:48]]></wp:post_date_gmt>
<wp:post_modified><![CDATA[2024-06-10 12:28:55]]></wp:post_modified>
<wp:post_modified_gmt><![CDATA[2024-06-10 12:28:55]]></wp:post_modified_gmt>
<wp:comment_status><![CDATA[open]]></wp:comment_status>
<wp:ping_status><![CDATA[open]]></wp:ping_status>
<wp:post_name><![CDATA[hello-world]]></wp:post_name>
<wp:status><![CDATA[publish]]></wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type><![CDATA[post]]></wp:post_type>
<wp:post_password><![CDATA[]]></wp:post_password>
<wp:is_sticky>0</wp:is_sticky>
<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
<wp:postmeta>
<wp:meta_key><![CDATA[_pingme]]></wp:meta_key>
<wp:meta_value><![CDATA[1]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key><![CDATA[_encloseme]]></wp:meta_key>
<wp:meta_value><![CDATA[1]]></wp:meta_value>
</wp:postmeta>
</item>
</channel>
</rss>

Loading