Git Product home page Git Product logo

Comments (11)

bobbingwide avatar bobbingwide commented on June 30, 2024

Unpack to wp-a2z

Instead of unpacking to the wp-content/themes folder I implemented similar logic for plugins... install the theme.
This has its drawbacks...

This logic doesn't cater for themes which are not supported in the currently installed version of WordPress.

Notes:

  • wecodeart required 5.9-beta3.
  • When I updated to 5.9-beta3 I got Notices.
  • Reverting to 5.9-beta2 resolved the issue..

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

fetch theme info

In the first version of this routine I've used the logic I developed for wp-top12 - accessing the theme's info from a cached version of the theme info. in cache_t2/wporg_saved.themes.slug.json where slug is the theme's slug eg tt1-blocks.

This assumes that the wp-top12 downloads routine has been run for all FSE themes.

If I were to want to use this logic on blocks.wp-a2z.org then I need the following:

  1. wp-top12 to be installed on wp-a2z.org, but not necessarily activated
  2. if WP_org_downloads_themes::get_theme() returns null it attempt to load and save the theme info. ie. update the cache.
  3. This information could therefore be used to provide the wp-top12 report for WordPress FSE themes on blocks.wp-a2z.org

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

If I were to want to use this logic on blocks.wp-a2z.org

I tried this and discovered other problems

  • It appears that Jetpack loads wp-admin/file.php which causes a problem when we try to load it.#

Workaround: deactivate Jetpack.

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

find directory for patterns

In Gutenberg 12.1.0, templates and template parts are expected to be found in predefined folders.
But patterns are not.
The Twenty Twenty Two theme registers its patterns in response to init. See inc/block-patterns.php.
The callback function is twentytwentytwo_register_block_patterns.
The patterns are themselves stored in inc\patterns.

After filtering the required patterns are registered

register_block_pattern(
			'twentytwentytwo/' . $block_pattern,
			require $pattern_file
		);

Other themes register the patterns with inline structures
Each pattern has a number of fields. Some are required.

Field Example Notes
name twentytwentytwo/general-divider-dark
title Divider with image and color (dark) Translatable
content Block HTML markup for the pattern, which may contain PHP to provide variable results at run time
description Optional
viewportWidth Optional
categories [ featured ] Array of categories
keywords Array of keywords
blockTypes Optional array of blocks

Documentation for register_block_pattern() doesn't quite match the usage in Twenty Twenty Two, which uses blockTypes and categories but not other fields.

If we want to simulate the pattern registration we can consider loading and invoking the callback function programmatically.
This is preferable to making the theme the active theme.
But it's a bit of a fiddle.

if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
			// Remove core patterns except 'Two Columns of Text'.
			// Unfortunately, \WP_Block_Patterns_Registry::get_instance()->get_all_registered() doesn't return the pattern names as keys.
			foreach ( \WP_Block_Patterns_Registry::get_instance()->get_all_registered() as $pattern ) {
			

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

find directory for patterns

The solution I found for patterns was to use the preview_theme capability in oik-patterns. See bobbingwide/oik-patterns#4

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

There are now 64 FSE themes registered in wordpress.org https://wordpress.org/themes/tags/full-site-editing/
I need a quick process that will register the themes in blocks.wp.a2z then clone them to blocks.wp-a2z.org
OR to simply run on the live server.

In addition to the 10 new themes that need installing and cataloguing 42 of the themes installed in wp.a2z need updating.
We need logic similar to that for blocks to

  • obtain a list of all FSE themes
  • for each new theme or any theme with updates
    • download the latest version
    • create/update the oik-themes entry
    • run the patterns preview logic

Proposed solution

Update oik-themer.php

  • To find the list of themes to update / install using the theme listing logic from wp-top12
  • To not download a theme version for a theme which is a Git repository ( similar to blocks.php )
  • To create a theme that's missing and update a theme's modified date when it needs it.
  • To run the theme_preview request to repopulate the patterns.
  • Preferably the solution should work both on Windows and the live server.
  • To be able to update themes which aren't hosted on wordpress.org ( eg fizzie and wizzie )

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

oik-update v1.3.0 is now on wp-a2z.org and oik-themer.php has been run.
There was one glitch due to the Grigori Blocks theme requiring PHP 7.4 but PHP version on the command line was 7.3
Resolved by setting the PHP version to 8.0 by updating the alias.

alias php='/usr/local/php80/bin/php-cli'

64 themes on wordpress.org are now published on blocks.wp-a2z.org.
See the theme summary https://blocks.wp-a2z.org/about/fse-themes-summary/

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

Note: The themes process can be run on both blocks.wp.a2z and blocks.wp-a2z.org.
It should produce the same results in both environments.
Doing this is quicker than the original process which involved running the themes routine on both sites.
And a hell of a lot faster than the previous process which required the themes to be installed and updated manually.

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

I closed this issue before completing the tasks listed in April. Now there's a new theme, twentytwentythree, which isn't yet on wordpress.org but which I want to document. Running themes twentytwentythree didn't work. But I need to register it to both blocks.wp.a2z ( blocks and themes ) and wp.a2z ( WordPress a2z plugins and themes ). Re-opening therefore.

The task to implement is this one.

  • To be able to update themes which aren't hosted on wordpress.org ( eg fizzie and whizzie )

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

TwentyTwenty-Three is now on wordpress.org... but there's another problem.
If a theme is no longer tagged full-site-editing then it doesn't appear in wordpress.org's list
but it's not removed from my site.
It appears that the them called Edunation was updated on 10th November.
Some of the tags were changed in style.css.
full-site-editing became Full Site Editing.

Assuming this was an intentional change there are two problems to address

  1. The original .json file should have been removed
  2. There should be some additional reconciliation logic to compare the registered themes.

from oik-update.

bobbingwide avatar bobbingwide commented on June 30, 2024

The latest problem I had was when the system attempted to update a theme requiring a parent theme.

Downloading: https://downloads.wordpress.org/theme/gutenify-architech.1.0.2.zip
Written: /home/customer/www/bobbingwide.org.uk/public_html//downloads/themes/gutenify-architech.1.0.2.zip
Bytes: 2032044
<div class="wrap"><h1></h1><p>Unpacking the package&#8230;</p>
<p>Installing the theme&#8230;</p>
<p>Removing the old version of the theme&#8230;</p>
<p>This theme requires a parent theme. Checking if it is installed&#8230;</p>

Fatal error: Uncaught Error: Call to undefined function themes_api().

Fatal error: Uncaught Error: Call to undefined function themes_api() in /home/customer/www/bobbingwide.org.uk/public_html/wp-admin/includes/class-theme-upgrader.php:141
Stack trace:
#0 /home/customer/www/bobbingwide.org.uk/public_html/wp-includes/class-wp-hook.php(308): Theme_Upgrader->check_parent_theme_filter(true, Array, Array)
#1 /home/customer/www/bobbingwide.org.uk/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(true, Array)
#2 /home/customer/www/bobbingwide.org.uk/public_html/wp-admin/includes/class-wp-upgrader.php(642): apply_filters('upgrader_post_i...', true, Array, Array)
#3 /home/customer/www/bobbingwide.org.uk/public_html/wp-admin/includes/class-wp-upgrader.php(815): WP_Upgrader->install_package(Array)
#4 /home/customer/www/bobbingwide.org.uk/public_html/wp-admin/includes/class-theme-upgrader.php(250): WP_Upgrader->run(Array)
#5 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-update/classes/class-OIK-themer.php(221): Theme_Upgrader->install('/home/customer/...', Array)
#6 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-update/classes/class-OIK-themer.php(182): OIK_themer->update_installed_theme()
#7 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-update/oik-themer.php(160): OIK_themer->download_theme_version()
#8 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-update/oik-themer.php(198): oik_themer_update_component_version(Object(OIK_themer), 'gutenify-archit...', '1.0.2')
#9 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-update/oik-themer.php(141): oik_themer_update_components_that_need_it(Object(OIK_themer))
#10 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-update/oik-themer.php(206): oik_themer()
#11 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-batch/libs/oik-cli.php(605): require_once('/home/customer/...')
#12 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-batch/libs/oik-cli.php(573): oik_batch_run_script('oik-themer.php')
#13 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-batch/oik-wp.php(117): oik_batch_run()
#14 /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-batch/oik-wp.php(156): oik_wp_loaded()
#15 {main}
  thrown in /home/customer/www/bobbingwide.org.uk/public_html/wp-admin/includes/class-theme-upgrader.php on line 141

from oik-update.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.