Git Product home page Git Product logo

fizzie's Introduction

fizzie

screenshot

Fizzie theme - a Full Site Editing theme using Gutenberg blocks.

Description

A Full Site Editing (FSE) with Gutenberg blocks.

The theme is required to replace the Genesis-a2z theme that is used in blocks.wp-a2z.org and core.wp-a2z.org.

It's also the parent theme of Wizzie, used in woocommerce.wp-a2z.org.

Requirements:

  1. Implement Full Site Editing.
  2. Same look and feel as the Genesis-a2z theme.
  3. Support documentation / demonstration of each of the new blocks in Gutenberg.
  4. Find out what bits are missing from and/or not working on Gutenberg.
  5. Implement on blocks.wp-a2z.org, core.wp-a2z.org and woocommerce.wp-a2z.org

Contents:

  • 19 templates
  • 34 template parts

The templates are:

  • 404 - Not found page

  • archive - generic template used for archives: author, taxonomy, date, tag

  • archive-block - to display archives for Blocks

  • archive-oik-plugins - to display archive for Plugins

  • archive-oik-themes - to display archive for Themes

  • category - used to display the Category archive

  • front-page - used for Page Shown On Front

  • home - used for Blog Posts index page or Posts Shown on Front (when front-page not implemented)

  • index - used when no other template is found

  • output-input - custom template for debugging output vs input

  • page-13.html - template for page ID 13

  • page-about - template for page with slug about

  • page-i18n-test.html - template for Internationalization test

  • search - Display search results

  • single - used for a single post / attachment / CPT

  • single-full - custom full width template for post,page,block and block_example

  • single-oik-plugins - used for a single oik-plugin

  • single-oik-themes - used for a single oik-theme

  • singular - used when single or page does not exist

  • See the template visualization: https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23-00.20.04.png

The parts are:

  • a2z-pagination - Letter pagination for blog posts
  • a2z-pagination-block - Letter pagination for blocks
  • a2z-pagination-oik-plugins - Letter pagination for plugins
  • a2z-pagination-oik-themes - Letter pagination for themes
  • archive-query - Main query for archive pages
  • breadcrumbs - Breadcrumb trail - using sb-breadcrumbs-block-based-widgets
  • category-description - Displays the category description
  • category-query - To list posts in a chosen category term
  • comments - Comments template part
  • contents-shortcode - Contents shortcode etc for the output-input custom template
  • download - To download plugins - uses [oikp_download] shortcode
  • download-theme - To download themes - uses [oikth_download] shortcode
  • footer - Final full width footer
  • footer-menu - Displays the footer menu - after the final full width footer
  • footer-variant-example - Example of a footer template part
  • header - Displays the header: site logo, site title and tagline, header menu.
  • header-menu - Displays the header menu
  • header-variant-example - Example of a header template part
  • home-part - A template part used in debugging. Classic block
  • home-query - Displays the posts on the blog page
  • i18n-rich-text.html
  • i18n-test - Internationalization, extraction and localization test file
  • information - Displays post meta data using the oik-block/fields block
  • issue-27 - test case file for issue-27
  • issue-30 - test-case file for issue-30
  • metadates - Displays Date published, last updated and [Edit] link
  • no-posts-found - Displays No posts found on 404 page
  • page-content - Primary content part for a page
  • page-footer - Full width footer with 3 columns - representing widgets
  • post-content - Primary content part for a post
  • post-content-full - Full width post content
  • posts - An attempt to display the posts using query blocks - incomplete- not used
  • search - Using the Search block
  • social-links - Social link icons

Templates not yet implemented:

Some of these templates will be needed for other subdomains of wp-a2z.org.

  • archive-CPT - archive templates for other custom post types - 5 to do
  • image - template for the image mime type
  • page - used for a single page -but see page-13, page-about and page-i18n-test
  • single-CPT - single templates for other custom post types - 10 to do
  • tag - for a particular tag
  • taxonomy - for a particular taxonomy
  • taxonomy-oik_letters - taxonomy specifically for oik_letters

Installation

  • Either install Gutenberg 10.7.1 or higher or install and build the latest Gutenberg source.

  • Activate Gutenberg.

  • Install and activate the Fizzie theme, as you would install any other theme. Full Site Editing will be enabled automatically.

  • For some of the templates and template parts to work properly you will need to install and activate the pre-requisite plugins.

  • Pre-requisite plugins: see also Notes

  • oik

  • oik-fields

  • oik-a2z

  • sb-breadcrumbs-block

  • sb-post-edit-block

  • Yoast SEO - for breadcrumbs logic

For the Output Input Debugging custom template

Change Log

1.3.0

  • Changed: Remove theme:fizzie attribute. #87
  • Changed: Support PHP 8.1 and PHP 8.2 #86
  • Changed: Update language files
  • Fixed: Avoid Fatal Uncaught TypeError in Appearance > Site Editor #85
  • Fixed: Ensure [bw_fields] shortcode is expanded within query loops for both shortcode and paragraph blocks #28
  • Fixed: Re-enable localization of template parts #46
  • Fixed: Revert workaround for recursion. Gutenberg was fixed in Mar 2021 #49
  • Tested: With WordPress 6.4-RC3 and WordPress Multisite
  • Tested: With Gutenberg 16.9.0
  • Tested: With PHP 8.0, PHP 8.1 and PHP 8.2

1.2.0

  • Fixed: Remove margin-block-start for .bw_blog #80
  • Changed: Remove logic moved to gcptedit. #75
  • Changed: No longer need to register_nav_menu() #84
  • Changed: Update Copyright years #84
  • Changed: Further restrict footer styling #84
  • Changed: Display post content full width for single oik-themes #83
  • Fixed: Fix Fatal error due to invalid attributes #82
  • Added: Add pattern for an About us page #78
  • Added: Add .json files for patterns to be used as page templates #78
  • Tested: With WordPress 6.2-beta5 and WordPress Multi Site
  • Tested: With Gutenberg 15.3.1

1.1.0

  • Changed: set background for foster-child table rows
  • Fixed: Remove theme attribute from template-part blocks #79
  • Fixed: Avoid undefined id #81
  • Tested: With WordPress 6.0 and WordPress Multi Site
  • Tested: With Gutenberg 13.4.0

1.0.0

  • Changes for the following issues: #11 #12 #13 #15 #24 #25 #26 #72 #74 #76 #77 #78

For details see the Git commit history.

  • Tested: With WordPress 5.9-RC3and WordPress Multi Site
  • Tested: With Gutenberg 12.4.0
  • Tested: With PHP 8.0

0.7.0

  • Changed: Add styling for metadates. #23 #71
  • Changed: Add bottom margin for post template list. #70
  • Changed: Don't override core/query-loop anymore. #33 #70
  • Fixed: Correct bw_trace2() args for when oik-bwtrace is not activated
  • Changed: Change metadates className to is-style-flexed #71
  • Changed: Rename query-loop to post-template. #70
  • Changed: Don't set default font-family. Use different CSS property for nav menus #69
  • Fixed: Correct styles: typography.fontFamily and elements.link.color.text #3
  • Changed: Enable WooCommerce background colour for navigation menus #69
  • Changed: Start enabling Fizzie as a parent theme #69
  • Changed: Enqueue category.css from the template (parent) theme #69
  • Tested: With WordPress 5.8 and WordPress Multi Site
  • Tested: With Gutenberg 11.1.0
  • Tested: With PHP 8.0

0.6.1

  • Changed: Replace [guts] shortcode with oik-bbw/wp using g attribute
  • Changed: Update screenshot for Gutenberg 10.7.1 WordPress 5.7.2
  • Changed: Rework home-query to use the Query block. Issue #11
  • Changed: Set post title as link

0.6.0

  • Changed: Adjust header menu for Gutenberg 10.7.1. Issue #26
  • Changed: Remove redundant styling for the 3 column archive
  • Changed: Update screenshot for 10.4.0
  • Changed: No longer override certain blocks. This disables language versions.
  • Changed: Refresh from DB version
  • Changed: Use query block with inherit true and update pagination block. Issue #11
  • Changed: Simplify add_theme_support logic. Remove unneeded stuff.
  • Changed: Switch to using theme.json issue #3
  • Tested: With Gutenberg 10.7.1 and WordPress Multi Site
  • Tested: With WordPress 5.7.2 and WordPress Multi Site
  • Tested: With PHP 8.0

0.5.0

  • Added: Add Input Output Debugging custom template,#65
  • Changed: Improve support for align wide and align full,#44
  • Changed: Add Header and Footer template variant examples,#60
  • Changed: Add query-title to archive.html to aid the block's documentation,#60
  • Changed: Replace [archive_description] by query-title and term-description,#60
  • Changed: Add .gitignore to ignore custom.css and/or oik-custom.css,#57
  • Changed: Override nav menu spacing and colour again for Gutenberg 10.3.0,#26
  • Changed: Set default template part tagName based on template area,#55
  • Tested: With Gutenberg 10.4.0
  • Tested: With WordPress 5.7 and WordPress Multi Site
  • Tested: With PHP 8.0

0.4.0

  • Changed: Another attempt at supporting alignfull and alignwide - solution copied/cobbled from TT1-blocks,#44
  • Fixed: Avoid problems attempting to valid the id attribute. Just unset it!,#52
  • Fixed: Adjust the width of submit buttons from 100% to auto
  • Tested: With Gutenberg 10.1.1
  • Tested: With WordPress 5.7 and WordPress Multi Site
  • Tested: With PHP 8.0

0.3.1

  • Changed: Rename more query-pagination blocks to query-pagination-numbers,,#11
  • Changed: Rename editor-style.css to style-editor.css and set block widths in the editor

0.3.0

  • Changed: Change from overriding query-pagination to query-pagination-numbers,#18
  • Changed: Add support for oik-themes - for FSE themes,#51
  • Changed: Update experimental-theme.json to new structure - with Gutenberg 10.0.0,#3
  • Changed: relocalize updated template parts,#46
  • Changed: Style radio buttons with width:auto
  • Changed: Update Copyright years in the footer
  • Changed: Workaround to prevent recursion occurring in the editor,#49
  • Changed: Move metadates template part back into the group, with className alignfull,#44
  • Changed: Allow nested template parts with class alignfull to use 100% width,#44
  • Changed: Remove workaround for post-excerpt,#25
  • Changed: Improve styling of blog display ( home.html ),#4
  • Tested: With Gutenberg 10.0.2
  • Tested: With WordPress 5.7-beta3
  • Tested: With PHP 8.0

0.2.0

  • Added: Extracted and localized to UK English ( en_GB ) and the obfuscated bbboing language ( bb_BB ),#46
  • Changed: Add more templates to test the template hierarchy logic: page-13, page-about and search,#38
  • Changed: Enable cloning from wp.a2z to wp-a2z.org,#48
  • Changed: Remove empty paragraph from page footer,#4
  • Changed: Update 'naughty' message from index.php
  • Changed: Update screenshot for v0.1.1
  • Fixed: Add text domain to 'No posts found'
  • Fixed: Update home.html to use header.html,#36

0.1.1

  • Added: Create archive templates & a2z pagination parts for block & oik-plugins,#36
  • Added: Debug information for each template,#41
  • Changed: Add social links in the footer,#4
  • Changed: Copy images from genesis-a2z; even if not actually used,#4
  • Changed: Improve styling of footer.,#4
  • Changed: Set min-height 60px for h2 on post-type-archive-block only.,#4
  • Changed: The About menu item should link to the about page,#17
  • Changed: Try to properly implement alignwide and alignfull styling capability,#44
  • Fixed: Add a shim to enable Navigation menus to display in the Front end on WordPress 5.6-RC1,https://github.com/bobbingwide/issues/42
  • Fixed: Correct [sites] shortcode to [bw_blogs],#4
  • Fixed: Correct reference to $this->bad_processed_content,#36

0.1.0

  • Changed: Add styles used for the test of core/post-content recursion detection, Issue #33
  • Changed: Continue refactoring recursion detection and error reporting, Issue #33
  • Changed: Set preset font sizes in pixels. Set default fonts for core/post-title and core/post-date, Issue #4
  • Changed: Update the footer menu to match blocks.wp-a2z.org, Issue #4

0.0.9

  • Changed: Refactored block-override-functions as Fizzie_Block_Recursion_Control, Issue #33
  • Changed: Revert to using block content postId to check for recursion in core/post-content, issue #27
  • Changed: Refactor overrides for core blocks into separate files, issue #25
  • Tested: With WordPress 5.6-beta4

0.0.8

  • Added: Disable the logic that attempts to insert the global post ID into the $fizzie_processed_content array. Issue #31
  • Added: Attempt to allow recursive reusable block problems to be fixed using the editor. Issue #31
  • Changed: Start refactoring of overrides. Issue #25
  • Added: Improve solution to detect recursive post-content blocks. Issue #27
  • Added: Improve solution to detects recursive template-parts. Issue #30
  • Added: core/post-hierarchical terms - cater for unknown taxonomies. Issue #29
  • Added: Attempt to avoid infinite recursion in the core/post-content block. Issue #27
  • Changed: Restructure home.html to use a simplified home-query.html that uses metadates.html, and metadates.html to use [bw_field]

0.0.7

  • Changed: Improve CSS styling for nav menus,#26
  • Changed: Define CSS styling for metadates template part,#23
  • Changed: Improve CSS styling for certain block types,#4
  • Added: Implement metadates template part,#23
  • Changed: When Template Part Not Found is displayed show information for problem determination,#16
  • Added: Add [post-edit] shortcode temporary solution,#24
  • Changed: Update header menu links to match the header menu in blocks.wp-a2z.org,#17
  • Changed: Start implementing menu improvements - by fiddling url and className attributes,[#22

0.0.6

  • Added: Improve solution to fix some Gutenberg issues by replacing render_callback functions with our own.,#18
  • Fixed: Correct badly formed template-part for footer-menu,#19
  • Changed: Update templates and parts for better matching of functionality in genesis-a2z,#4
  • Added: Add posts.html template part - not yet used
  • Changed: Fix up CSS messed up by experimental-theme.json changes.,#3
  • Added: Implement main query pagination for the core/query-pagination block,#18
  • Experiment: Attempt to define typography for core/post-title in experimental-theme.json
  • Changed: Improve styling for h1-h6, separator, preformatted and verse. Add some more colour presets and font sizes
  • Tested: With WordPress 5.6-beta3 and WordPress Multi Site
  • Tested: With Gutenberg 9.2.2, 9.3.0 and development
  • Tested: With PHP 7.4

0.0.5

  • Added: single-oik-plugins template,#14
  • Changed: archive template,#14
  • Changed: Extracted header and footer menus into separate template parts [#17

0.0.4

  • Changed: Create [archive_description] shortcode for the category-description template part,#13
  • Tested: With WordPress 5.6-beta2
  • Tested: With Gutenberg 9.2.2 and development - with a local fix for #25377
  • Tested: With PHP 7.4

0.0.3

  • Changed: Improve styling of drop down menu and page footer column background,#4
  • Added: Implement the 404.html template,#12
  • Changed: remove wp:query to allow use of the main query in archive based templates,#11

0.0.2

  • Added: Implement category.html template,#9
  • Changed: Style the 'home' template - for blog posts,#4
  • Changed: Style page-footer content to be same width as page and post,#1
  • Changed: Support header and footer menus. #1 (comment)
  • Fixed: update wp:template-part to remove postId attr; set theme attr to fizzie
  • Added: Update the theme's files extracted from the exported zip file. See #1 (comment)

0.0.1

  • Added: Start styling as genesis-a2z,#4
  • Added: Enable oik shortcodes in template parts,#5
  • Changed: Copy some stuff from the Stanley theme as per fullsitediting.com,#4
  • Changed: Play with editor-style.css for dropcap and header
  • Changed: Start to support experimental-link-color, reload latest style.css when SCRIPT_DEBUG true, try Twenty Seventeen's frontpage_template hook
  • Changed: Added then delete template part posts in index.html - never ending loop problem
  • Added: Put some logic in index.php for when Gutenberg is not active
  • Added: Add editor-style.css to style the blocks in the editor to the same as the front end,#4

0.0.0

Notes

The theme is designed for use on wp-a2z.org.

It implements template parts which depend on external components. For example

  • a2z pagination requires oik-a2z plugin
  • breadcrumbs requires sb-breadcrumbs-block

The CSS is minimal; just enough to make it look OK on my laptop and external monitor. Responsibility for responsive styling is left to Gutenberg / WordPress core functionality.

Block overrides

Fizzie contained a number of overrides to Gutenberg server rendered blocks which didn't behave the way I expected. Many of these are no longer necessary and have been disabled.

Improvement areas included:

  • core/query-loop - uses main query when used outside of core/query
  • core/query-pagination - uses the main query when used outside of core/query
  • core/block - handle recursion
  • core/post-hierarchical-terms - cater for invalid taxonomy
  • core/navigation-link - set current-menu-item class for current request
  • core/navigation - tbc
  • core/template-part - handle recursion
  • core/post-content - handle recursion
  • core/post-excerpt - append missing </div>

For more information see #25 and/or the includes folder.

References

See my articles on herbmiller.me:

During the development, in 2021, I referred to the following articles, sites and repositories.

Some other FSE themes:

Brief development history

Even though FSE was not going to make it into WordPress 5.6 or 5.7, I had to implement the theme in order to document the 24 or so new blocks that were already in Gutenberg and that will eventually appear in WordPress core.

It started as a completely empty theme and then I played with it while following some tutorials.

The tutorials didn't really cover the Site Editor (beta) user interface. So I was on my own from there on. Itโ€™s been quite a learning experience. Rather than using the Site Editor ( beta ) user interface, I've found it easier to edit the Templates and Template parts directly.

I've been using the block editor in Code editor mode, then copying and pasting the individual templates and template parts to the .html files that the theme needs to deliver. In some cases these had to be edited to remove the "postId" attributes.

In the target site(s) some of the template parts need importing into the Site Editor to be customised for the target site. These are the ones that include the navigational blocks.

  • Note: You can set the Site icon without having to edit a template or template part. Just create a new post, add the Site icon block and select the image file.

Copyright

(C) Copyright Herb Miller, Bobbing Wide 2020, 2021, 2022, 2023

  • This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

fizzie's People

Contributors

bobbingwide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

andrewmleonard

fizzie's Issues

Template hierarchy test cases

When I first started developing Fizzie I created a front-page.html template.
I found that this was being used even when the Your homepage displays radio button was set to Latest posts
See #1 (comment)
This was very early days, before the core/query block did anything like I expected it to.

Now, with Gutenberg 9.4.0 I'm seeing the wrong templates being used to display my content.
I need to document what I expect for particular URLs and to confirm the results with Gutenberg 9.3.0 and 9.4.0.
Refer to https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23-00.20.04.png

These results were determined for my non-FSE themes genesis-hm and genesis-a2z
The template files are .php files.

Your homepage displays Template hierarchy True conditionals
Your latest posts front-page, home, index is_front_page, is_home
A static page; Home front-page, page-*, singular, index is_front_page, is_page, is_singular
A static page: Blog home, index is_home

page-* represents multiple levels of specificity: page-slug, page-ID, page

URL Template hierarchy True conditionals
a post single-post-*, single, singular, index is_singular, is_single
a page page-*, singular, index is_page, is_simgular
a block single-block-*, single, singular, index is_single, is_singular
block (archive) archive-*, index is_archive, is_post_type_archive
category
tag
taxonomy these to be completed some day!
date query
search
not found

Navigation menus not appearing in front-end with WordPress 5.6-RC1

Originally raised as #38, I'm raising this as a new issue since I think it's better to track it down now if it's a core problem rather than a Gutenberg problem. It would be easier if it's a Gutenberg problem because I'll be able to fix it.

Problem is that the navigation menus don't appear at all.

Create single and archive pages for oik-plugins custom post type

In the genesis-a2z theme the following PHP templates are used for the oik-plugins CPT.

Single page - single-oik-plugins.php
Archive page - archive.php

Requirement

Create FSE templates for both of these.

  • single-oik-plugins.html
  • archive-oik-plugins.html

Single page template parts

image

  • Header
  • Breadcrumbs
  • Content

image

  • Information
  • Download
  • Search
  • Page footer
  • footer

In the screen captures Content and Page footer are only partially shown. Footer is not shown at all.

Archive page

image

  • Header
  • Letters selection
  • Breadcrumbs
  • Category description. Is this really necessary for the Letters category?
  • 3 column display of block title with link and featured image
  • Search
  • Page footer
  • footer

Note: The 3 column display is different from that already delivered in archive.html, which uses category-query.html.
Looks like archive.html should use a different template part to implement the 3 column main query.

Investigate why shortcodes don't work in template-parts

In blocks.wp-a2z the widget areas are mostly populated by shortcodes.
These don't appear to work in the template parts used in Full Site Editing.
Is this a limitation of Full Site Editing or am I doing something wrong?
image

Answer: Something wrong.
I added a shortcode to the content of the page and they all started expanding.
It looks like I'll need to implement some logic to ensure shortcodes are enabled when it's a FSE theme.
It could be as simple as do_action( "oik_add_shortcodes" ); in functions.php

Navigation blocks don't appear with WordPress 5.6-RC1 & other issues

Having updated WordPress to 5.6-RC1, and Gutenberg to 9.4.0, my menus in s.b/wp56 don't appear at all.
No messages. Just blank spaces. There's also a different template being used.

WordPress Gutenberg Nav menu works? Template for Home
5.6-beta4 9.3.0 Yes home.html
5.6-beta4 9.4.0 Yes index.html
5.6-RC1 9.3.0 No index.html
5.6-RC1 9.4.0 No index.html

With 5.6-RC1 Settings > Reading
it appears that there's no setting for your homepage displays
image

Losing Your homepage displays settings on updating Settings > General

I recently noticed that when I changed the Site Title on Settings > General
the values I'd chosen for Your homepage displays on Settings > Reading were lost.

The unexpected result was that the template being used by Gutenberg FSE changed from front-page.html to home.html.

On deeper investigation I determined this be an upstream bug in Gutenberg 9.3+.
The version of WordPress is immaterial.

To reproduce:

  1. Ensure you have Gutenberg 9.3.0 or 9.4.0
  2. Visit Settings >Reading and set values for Your homepage displays. eg Static page: Home and Blog
  3. Visit Settings > General
  4. Save Changes
  5. Revisit Settings > Reading.
  6. The values you set in step 2. have gone. The radio button isn't set.

Screenshots

Step 2.
image

Step 6.
image

No matching template found - Gutenberg 9.4.0-RC1

I updated to Gutenberg 9.4.0-RC1 prior to delivering my fix for #35.
On blocks.wp.a2z I got "No matching template found".

Problem analysis

Turns out it was a forward slash backslash problem in Windows..

Temporary fix

Change line 128 of lib\templates.php, function _gutenberg_synchronize_theme_templates()

strpos( $path, $template_base_path . DIRECTORY_SEPARATOR ) + 1 + strlen( $template_base_path ),

Unexpected empty paragraphs produced rendering home-query.html template part

With the home-query.html template part I noticed a number of white sections which were associated with empty paragraphs.
image

<!-- wp:group {"className":"posts"} -->
<div class="wp-block-group posts"><div class="wp-block-group__inner-container"><!-- wp:columns -->
    <div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
        <div class="wp-block-column" style="flex-basis:100%"><!-- wp:query-loop -->
            <!-- wp:group -->
            <div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:post-title /-->

                <!-- wp:post-featured-image {"isLink":true} /-->

                <!-- wp:post-excerpt {"moreText":""} /-->

                <!-- wp:columns -->
                <div class="wp-block-columns"><!-- wp:column {"width":"33.33%"} -->
                    <div class="wp-block-column" style="flex-basis:33.33%"><!-- wp:paragraph -->
                        <p>Published:</p>
                        <!-- /wp:paragraph -->

                        <!-- wp:paragraph -->
                        <p>Last updated:</p>
                        <!-- /wp:paragraph -->

                        <!-- wp:paragraph -->
                        <p>Filed Under:</p>
                        <!-- /wp:paragraph --></div>
                    <!-- /wp:column -->

                    <!-- wp:column {"width":"66.66%"} -->
                    <div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:post-date {"format":"F j, Y"} /-->

                        <!-- wp:post-date {"format":"F j, Y"} /-->

                        <!-- wp:post-hierarchical-terms {"term":"category"} /--></div>
                    <!-- /wp:column --></div>
                <!-- /wp:columns --></div></div>
            <!-- /wp:group -->

            <!-- wp:spacer {"height":39} -->
            <div style="height:39px" aria-hidden="true" class="wp-block-spacer"></div>
            <!-- /wp:spacer -->
            <!-- /wp:query-loop --></div>
        <!-- /wp:column --></div>
    <!-- /wp:columns -->
    <!-- wp:query-pagination /-->
</div></div>
<!-- /wp:group -->

Explanation

  • These unexpected white sections were associated with empty paragraphs that had been generated by wpautop()
    run against the content generated gutenberg_render_block_core_template_part() ...
    Actually, my latest version, fizzie_lazy_render_block_core_template_part( ).

I need to check whether or not it's any of my own plugins that are causing this.

Improve hardcoded navigation menus to use the correct site_url() rather than original value

I've been creating the theme in s.b/wp56 so the url attribute in the navigation-link blocks is of the form https://s.b/wp56/permalink/

Here's the current footer menu.

<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"center"} -->
<!-- wp:navigation-link {"label":"Blog page","url":"https://s.b/wp56/blog-page/"} /-->

<!-- wp:navigation-link {"label":"home-page","url":"https://s.b/wp56/"} /-->

<!-- wp:navigation-link {"label":"Trying to build Fizzie","url":"https://s.b/wp56/2020/10/trying-to-build-fizzie/"} /-->
<!-- /wp:navigation -->

When I implement the theme on blocks.wp-a2z, blocks.wp-a2z.org and other subdomains I'll want the menu items to point to the current site. I want the correct site url = as provided by site_url().

Proposed solution

In the absence of a solution delivered by Gutenberg, intercept the server side rendering using the same method as documented in #18.

eg

function fizzie_render_block_core_navigation_link( $attributes, $content, $block ) {
    $attributes = fizzie_nav_atts( $attributes );
    $html = gutenberg_render_block_core_navigation_link($attributes, $content, $block);
    return $html;
}

function fizzie_nav_atts( $attributes ) {
    $attributes['url'] = str_replace( 'https://s.b/wp56', site_url(), $attributes['url'] );
    return $attributes;
}

And while we're at it....
Apparently the logic already supports current-menu-item - see
WordPress/gutenberg#25575
so let's see if we can ensure that the current-menu-item class is set.

Looking at the current code, we need to set $attributes['id'] to the value of get_the_ID()
when the current URL is the same as the link's URL.

$is_active   = ! empty( $attributes['id'] ) && ( get_the_ID() === $attributes['id'] );
```

Add support for Themes - oik-themes

Full Site Editing (FSE) themes have started to appear on wordpress.org. I think it's time to start creating a catalogue of them.
Obviously the one that I know most about is Fizzie, but there are quite a few more I'm aware of. See /bobbingwide/oik-themes/issues/11.

Requirements

  • Ability to discover themes
  • Archive display of all FSE themes
  • Display of individual themes
  • Display of the templates and template parts
  • Display of other useful information about the theme

Proposed solution

  • Add Themes link to the main header menu - linking to oik-themes to display the archive
  • Add an archive-oik-themes.html template
  • Add a single-oik-themes template
  • Make use of improvements to oik-themes plugin

Create a metadates template part

In the genesis-a2z theme we display the Published date ( post_date ) and Last updated date ( post_modified ) at the bottom of the content.
This is followed by an (Edit) link, which enables authorised users to edit the content.

Published: November 6, 2020 | Last updated: November 6, 2020 (Edit)

Requirement

  • To display this information in a template area between the content and the information
  • Date values to be formatted using the site settings
  • Labels either to be text in the template or translatable strings in the theme
  • (Edit) link to only be displayed to authorised users

Proposed solution

  • implement a new template part called metadates.
    eg
<p>Published: [bw_fields post_date] | Last updated: [bw_fields post_modified] ( edit )</p>
  • update style.css / experimental-theme.json as required

Since:

  • we are dependent upon oik and oik-fields to display the post meta data in the Information box
  • we use oik-blocks to display block icons

in the short term solution for the date fields can be implemented as shortcodes such as [bw_field] or [bw_fields]
which could then be implemented in the oik-blocks/fields block.

The (Edit) link should be a separate shortcode ( bw_edit ) / block ( post-edit )

In the longer term I'd expect these to be implemented as core/post-date, core/post-modified and core/post-edit blocks.

I believe that some of these requirements have already been raised by members of the theme-experiments projects.

Need a post-modified-date block similar to core/post-date

In the genesis-a2z and genesis-oik themes for each post we display the Published date, Last updated date and an Edit post link.
These are implemented using genesis shortcodes.

Extract from the genesis-a2z theme.

$string = sprintf( __( 'Published: %1$s', 'genesis-oik' ), '[post_date]' );
	$string .= '<span class="splitbar">';
	$string .= ' | ';
	$string .= '</span>';
	$string .= '<span class="lastupdated">';
	$string .= sprintf( __( 'Last updated: %1$s', 'genesis-oik' ), '[post_modified_date]' );
	$string .= '</span>';
  $string .= ' [post_edit]';
	//$output .= apply_filters( 'do_shortcodes', $string);
	$output .= do_shortcode( $string );

Requirement

  • Display the same information in the Fizzie theme.
  • Preferably implement as blocks.

Proposed solution

  • A single block that can display the required field value and a text prefix.

Template Part Not Found for badly formed wp:template-part HTML comment

While developing the archive.html template file I encountered a problem where the Template Part Not Found message was displayed but there was no template name. The only attribute value passed to gutenberg_render_block_core_template_part() was tagName, with a value of div.

Analysis of the HTML comment that formed the wp:template-part block indicated that I was missing a comma between attributes.

<!-- wp:template-part {"slug":"footer-menu","theme":"fizzie" "className":"footer-menu"} /-->

It would be helpful if the error could be detected and a message produced.

wp:query-pagination block doesn't paginate the main query

The core/query-pagination block doesn't appear to work at present.
For pages that should be using the main query, I would have expected the pagination to work using URLs with /page/n,
where n is the page number.

I believe it should be possible to add this logic for when the core/query-loop block is the main query.
ie When not within the core/query block.

[bw_fields] shortcode not displaying values after first query-loop post

While testing a solution for issue #27 I started changing the home-query.html template part.
I wanted to use the metadates.html template part to replace the rather complicated ( and ugly ) columns block that I'd used to display Published and Last updated dates.

I noticed that for the second and subsquent posts in the query-loop the [post-edit] shortcode worked but the [bw_fields] ones did not. get_edit_post_link() calls get_post() to find the current post ID.
But the logic for [bw_fields] currently prevents the shortcode from doing anything when the current post is not the global post.
This was done to prevent a sidebar on an archive page from displaying the wrong information.

Proposed solution

I don't want to revert the change to [bw_fields].
If we extend [bw_fields] to work when the id attribute is '.' then this might resolve this problem.

Originally posted by @bobbingwide in #27 (comment)

Implement category template for the category taxonomy

Requirement

Display a grid of blog post titles in a particular category with the following structure

  • Standard header
  • Letter pagination menu
  • Breadcrumbs
  • Category description
  • Responsive grid of post title links - 3 columns down to 2 or 1
  • with Pagination
  • Page footer
  • Footer

image

Fatal error - memory exhausted trying to edit a wp_template

Also note that sometimes editing the CPTs directly caused an out of memory problem due to an infinitely descending loop of action hooks the_content and pre_render_block.

I'm going to raise this as a separate issue to see if this is something I've done or a problem with Gutenberg itself.

Originally posted by @bobbingwide in #1 (comment)

Problem

  • Attempting to use Appearance > Templates to edit a specific template part can lead to a timeout / memory exhausted issue.

With oik-bwtrace activated I got

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 585728 bytes) in C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\class-BW-trace-record.php on line 191

The trace log file was 364MB. The call stack at the end of the trace file was 3647 functions deep.

Fatal error in post-hierarchical-terms.php

Detected while trying to view https://s.b/wp55/fizzie/category/block-news/

Notice: Trying to get property 'term_id' of non-object in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php on line 32

Notice: Trying to get property 'name' of non-object in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php on line 33

Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in
C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php:33
Stack trace:
#0 C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php(33): sprintf('...', Object(WP_Error), '')
#1 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(219): gutenberg_render_block_core_post_hierarchical_terms(Array, '', Object(WP_Block))
#2 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(211): WP_Block->render()
#3 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(211): WP_Block->render()
#4 C:\apache\htdocs\wordpress\wp-content\themes\fizzie\functions.php(307): WP_Block->render(Array)
#5 C:\apache\htdocs\wordpress\wp-content\themes\fizzie\functions.php(263): fizzie_render_block_core_query_loop_main_query(Array, '', Object(WP_Block))
#6 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(219): fizzie_render_block_core_query_loop(Array, in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php on line 33

core/query block only offering a choice of 4 post types

Problem

When editing a page the core/query block's sidebar is only offering four post types:

  • Post
  • Page
  • Plugin
  • oik plugin version

To be usable the full list should include 13 other post types including:

  • Attachments
  • oik premium version
  • Blocks
  • Block examples

Question: So what's going wrong?

image

The other following offences should be taken into consideration.

  • Choosing order by A Z chooses order by Z A on first selection.
  • Orderby doesn't appear to work for oik plugins.
  • No ability to choose post_parent
  • Found post content with the More block produces - this block can only be used once.

Properly implement alignwide and alignfull styling

It appears I'm not the only one who doesn't really understand how to implement alignfull and alignwide styling on blocks.

Reading the issue entitled "How to style alignfull and alignwide" ( WordPress/gutenberg#8289 ) I can see a number of solutions but can't see any clearly documented requirements.

Whichever solution I go for I should understand my own requirements for Fizzie:

  • Initially a single column theme with no sidebars
  • then extended to support a theme with sidebars.

These are the widths I'm going to use:

Style Width Currently used for
normal 1140px most areas except header and footer
alignwide 1340px untried
alignfull 100% = 1519 pixels on my laptop header and footer

Explain the Warning: array_key_exists() messages displayed on search results

Warning: array_key_exists() expects parameter 2 to be array, null given in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg-wordpress-source\lib\block-supports\align.php on line 48

Warning: array_key_exists() expects parameter 2 to be array, null given in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg-wordpress-source\lib\block-supports\colors.php on line 73

Warning: array_key_exists() expects parameter 2 to be array, null given in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg-wordpress-source\lib\block-supports\colors.php on line 108

Warning: array_key_exists() expects parameter 2 to be array, null given in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg-wordpress-source\lib\block-supports\colors.php on line 125

Warning: array_key_exists() expects parameter 2 to be array, null given in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg-wordpress-source\lib\block-supports\custom-classname.php on line 46

post-content like post-excerpt and vice-versa?

Interestingly the post-excerpt block appeared more like the post-content block and vice-versa.

Well, the post-content block appeared more like an excerpt than post content.
In order to fix this I had to change the core function get_the_content() to set $elements['more'] to true, since generate_postdata() hadn't.

Not surprisingly this didn't resolve the problem with the post-excerpt ignoring the more block.

Originally posted by @bobbingwide in #27 (comment)

Problem

core/post-content when nested in a query in another post's query-loop's core/post-content block is broken by a more block.

image

While developing my fix for the post-content infinite recursion problem, I became aware of a problem with the display of post content in the nested posts. The workaround I implemented for #27 was to eliminate the more block from the content that was being displayed.

In the above screen capture I've re-introduced the core/more block into the Aab page.
The post content should be 'Aab - excerpt before more. Aab - post content after more.'
The More link shouldn't appear.

Experiment with experimental-theme.json

In parallel with #1 and #4 it makes sense to play with the experimental theme JSON file called experimental-theme.json.

https://developer.wordpress.org/block-editor/developers/themes/theme-json/

Requirements

  • Try to use experimental-theme.json to define the colours and font sizes for blocks such as paragraph, h1-h6 to match the current settings in genesis-a2z
  • Improve styling of blocks where I'd noticed problems while populating the block catalog.

Solution

Notes

  • genesis-a2z's style.css was 1800 lines, with very little, if any, custom styling for blocks.
  • I wondered how much styling I'd have to put into style.css and how much could go in the JSON file

Where should the Typography and Colours settings panels be in the sidebar?

While attempting to document each of the new blocks for FSE I noticed that the Panels in the Settings sidebar were

  • Typography
  • Colours
  • Block's specific settings

Question: Why aren't the Block's specific settings first?

It was pointed out in #core-editor Slack, by Andrรฉs,

the "FSE blocks" (navigation, post editor, etc) follow the model of existing blocks (paragraph, heading), in which the style related controls are above everything else.
Personally, I don't have a strong opinion on this, though. I presume there's a design balance to make here (consistency among blocks but also priority of the most used settings, etc).
Perhaps the G2 components project / design tools would be a good place to re-evaluate this?

An example

Here's a screen capture of the Post date block.

  • Which of the Settings am I more likely to want to change?
  • Which of the settings are Agencies more likely to want to restrict?

image

Proposed actions

  • Complete the documentation for all the new blocks
  • Use them for a while
  • See which settings I do use and where they are
  • Raise an issue anyway so that other people can express their views.
  • Write my own block ( e.g. Post Modified Date or Post Edit ) and see how the Settings panel appears.

Extend Gutenberg server rendering of templates and template parts for problem determination

While analysing the problems I came across with Gutenberg 9.4.0 I developed an extension to template-part.php which added debug information visible in the front end.
It sandwiched the output for each template part in some debug <div class="WP_DEBUG"> tags
which contained the name of the template part.

I then wrote some naff CSS to enable the information to be viewed on the front end.

image

Requirements

  • Formalise this solution for template parts
  • Find a method to automatically produce front end information regarding the template file that's been selected
  • Consider ways to easily turn the debug information on and off. e.g. Additional constant ( FSE_DEBUG), logged in admin user.

CSS styling - unexpected grey background between template parts

In #core-editor Slack I asked some simple questions which resulted in quite a few replies.
The result of this was that I decided to extract the navigation menus into separate template parts.
I started with the footer template part and converted the wp:navigation into a new template part called footer-menu.html.
Rather than embedding this directly into the footer template part I decided I'd just put it after the footer in each template.

But I found a problem with the CSS styling.
The footer and footer-menu template were separated with a light grey background between them

I intially thought it was a problem with unexpected characters between the HTML tags.
But these were just line feed characters ( \n aka hex 0a ).

I discovered that it was due to the margin property set on the nested paragraph and list blocks.
I have no idea why the margin on the paragraph was applied the way it did.
That's the wonder of CSS for you I suppose.

Nav menu items styling not as expected

When I started styling the nav menu I copied the CSS from genesis-a2z. The screenshot.png I took on 28th October showed the white space.
When I updated to Gutenberg 9.2.2 I noticed the space between menu items disappeared.
This is because there is no longer a blank space between list items.
This can easily be demonstrated using the the code inspector.
In this screen capture, from the genesis-a2z theme, I removed the blank space between a couple of items.
image

Requirement

Some spacing between the menu items.

Proposed solution

In order to regain the blank space I'll either need to change the CSS, or adjust the markup.
It makes more sense to use CSS.

Rich text controls disappear when Yoast SEO activated

I first noticed this problem while trying to use bold on a paragraph block in s.b/wordpress.
The Bold, Italic and More rich text controls toolicons are missing
The problem went away when I deactivated Yoast SEO 15.3 (screenshot 2) .
But I couldn't reproduce the problem in other environments.

image

image

Time to do some analysis to determine what's causing the problem

Environment WordPress Gutenberg Yoast SEO Other plugins Working?
s.b/wordpress 5.5.1 9.4.0 15.3 many No
s.b/wordpress 5.5.1 9.3.0 15.3 many No

A message in the console when it doesn't work is:

react-dom.82e849f1.js:1680 Warning: Failed prop type: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
    in select (created by y)
    in div (created by u)
...

Post excerpt in query loop is for the calling post not the post being listed

When a core/post-excerpt block is included in a query for pages/posts the post excerpt displayed is for the post that contains the core/query & core/query-loop blocks not the posts that were found.

It seems to work for Gutenberg 9.3.0 but not the Gutenberg source.

URLs WP GB Result
https://s.b/wp56/a/ beta3 9.3.0 doesn't work - same excerpt for each post
https://s.b/wp55/fizzie/pages-query/ beta4 MS 9.3.0 does work
https://s.b/wordpress/2020/11/15/posts-query-2/ 5.5.1 9.3.0 doesn't work - same excerpt for each post

Analysis

In wp55 the $block->context['postId'] value is correctly set for each invocation of fizzie_render_block_core_post_excerpt().
It's also correctly set in wp56.

The problem is due to oik-shortcodes adding its own filter function for get_the_excerpt with priority 9.
The filter function oik_get_the_excerpt obtains the excerpt from the global $post.

Since WordPress 4.5.0 the get_the_excerpt filter has been invoked with two parameters $post_excerpt and $post.

Solution

The oik-shortcode plugin should be changed. Two options

  1. make use of the $post parameter instead of global $post
  2. don't implement the filter.

Trying 1. first.

wp:query-loop doesn't dynamically use the chosen category

I've implemented the category.html template as far as possible, with the current Gutenberg FSE functionality.

There are a number of problems:

  • the query loop doesn't dynamically use the chosen category.
  • pagination doesn't work at all

Requirement

The Gutenberg blocks wp:query, wp:query-loop and wp:query can be used in templates and template parts to create user defined queries and pagination.

Currently ( Gutenberg 9.2.2 ) they don't support the main query that WordPress has already parsed.

This makes it extremely difficult to create archive pages that support the selected taxonomy term ( category, tags or custom taxonomy ).

I need a simple solution that allows me to process the posts in the main query.

Proposed solution

In the current implementation the wp:query-loop block is nested in the wp:query block.
The wp:post-* blocks are nested within the wp:query-loop.

eg

<!-- wp:query {"queryId":1,"query":{"perPage":2,"pages":1,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[542]}} -->
<!-- wp:query-loop -->
<!-- wp:post-title /-->
<!-- wp:post-featured-image {"isLink":true} /-->
<!-- wp:post-date /-->
<!-- wp:post-excerpt /-->
<!-- /wp:query-loop -->
<!-- /wp:query -->

The query-loop block uses the $block->context passed to it from the query block to construct the query.
When we want to process the main loop we need to execute the query already defined in global $wp_query.

This can be achieved using the following code:

function gutenberg_render_block_core_query_loop_main_query( $attributes, $content, $block ) {
    if ( have_posts() ) {
        $content = '';
        while ( have_posts() ) {
            the_post();
            $post = get_post();
            $content .= (
            new WP_Block(
                $block->parsed_block,
                array(
                    'postType' => $post->post_type,
                    'postId' => $post->ID,
                )
            )
            )->render(array('dynamic' => false));
        }
    } else {
        $content = "No posts found. So why isn't this a 404?";
    }
    return $content;
}

If we remove the outer wp:query block then the $block->context will not be set.
This will prompt us to run the main query.
eg

<!-- wp:query-loop -->
<!-- wp:post-title /-->
<!-- wp:post-featured-image {"isLink":true} /-->
<!-- wp:post-date /-->
<!-- wp:post-excerpt /-->
<!-- /wp:query-loop -->

Steps:

For query-loop:

  • Prototype a solution implemented in the callback function for the dynamic block wp:query-loop; gutenberg_render_block_core_query_loop() in query-loop.php.
  • Raise an issue against Gutenberg. . No need, there's one already: 25377
  • Create a pull request to implement the improvement.

For query-pagination:

  • take a similar approach as for query-loop
  • Raise a separate issue against Fizzie
  • Raise a separate issue against Gutenberg.

Unexpected messages viewing Uncategorised

In a brand new WordPress Multi Site site I visited
https://s.b/wp55/fizzie/category/uncategorised/
and got the following:

Notice: Trying to get property 'term_id' of non-object in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php on line 32

Notice: Trying to get property 'name' of non-object in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php on line 33

Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in 
C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php:33 
Stack trace: 
#0 C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php(33): sprintf('<a href="%1$s">...', Object(WP_Error), '') 
#1 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(219): gutenberg_render_block_core_post_hierarchical_terms(Array, '', Object(WP_Block)) 
#2 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(211): WP_Block->render() 
#3 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(211): WP_Block->render() 
#4 C:\apache\htdocs\wordpress\wp-content\themes\fizzie\functions.php(278): WP_Block->render(Array) 
#5 C:\apache\htdocs\wordpress\wp-content\themes\fizzie\functions.php(234): fizzie_render_block_core_query_loop_main_query(Array, '', Object(WP_Block)) 
#6 C:\apache\htdocs\wp55\wp-includes\class-wp-block.php(219): fizzie_render_block_core_query_loop(Array, in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\build\block-library\blocks\post-hierarchical-terms.php on line 33

Unexpected register_rest_route messages

<b>Notice</b>:  register_rest_route was called <strong>incorrectly</strong>. 
The REST API route definition for <code>udemy/v1/login</code> is missing the required <code>permission_callback</code> argument. 
For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback. 
Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. 
(This message was added in version 5.5.0.) in <b>C:\apache\htdocs\wp56\wp-includes\functions.php</b> on line <b>5225</b><br />

plus 4 or 5 more.

Attempt to create a FSE theme

Follow the instructions to create an FSE theme...
https://developer.wordpress.org/block-editor/tutorials/block-based-themes

Note: I've called the theme Fizzie since it sounds a bit like what you'd say if you quickly read out the letters F S E.
Where F = Full, S = Site and E = Editing.

Fizzie is/was the affectionate term for the Yamaha FS1E moped from the early 1970's.
It was a hybrid; more motorcycle than bicycle. It had pedals but you never rode it without starting the engine.

The Fizzie theme may also be considered to be a hybrid, with FSE template parts using server rendered shortcodes rather than native blocks. This is so I can implement the required functionality as quickly as possible.

Implement the 404.html template

In order to test #11 we need a 404 page. In genesis-a2z it's a bit basic.
image

Requirement

A 404.html page with the following sections

  • Header
  • Breadcrumbs
  • Not found message
  • ? The main loop - implemented as a template part
  • Search
  • Page footer
  • Footer

Style fizzie to be the same as genesis-a2z

This is a bit of an ask but...
In order to be able to document the blocks that are used in Full Site Editing in blocks.wp-a2z.org I need to enable Full Site Editing.
To achieve this with Gutenberg 9.2.x the theme needs to support:

  • a full-width styled header - with logo, site title, site info and menu
  • a body with max-width: 1140px
  • a widget area below the body - for search
  • a footer area with 3 columns
  • a full width bottom footer containing a footer menu

Create archive templates for block and oik-plugins custom post types

The general purpose archive.html template embeds the a2z-pagination.html template part

<!-- wp:template-part {"slug":"a2z-pagination","theme":"fizzie"} /-->

which contains

<!-- wp:paragraph -->
<p>[bw_terms]</p>
<!-- /wp:paragraph -->

By default the [bw_terms] shortcode uses the letters taxonomy.
For Plugins and Themes this is OK.
But for Blocks we need to use the block letters taxonomy.

Thererfore we need separate template files archive-block.html and archive-block_example.html both of which will reference a block-a2z-pagination.html template part that contains the shortcode [bw_terms block_letters].

Also, the post_type attribute needs to be specified.
Therefore we also need archive-oik-plugins.

The recursive template parts in Fizzie break Gutenberg's Template parts block

I wanted to test my rich text localization ( l10n) logic in Gutenberg 9.5.1 so I created a template part called i18n-rich-text.html.
I tried to load it using the Template part block in a page, while in the bb_BB locale.

But in s.b/wp56 I got This block has encountered an error and cannot be previewed even before I had a chance to pick the template part.
I believe this was due to the Template part block trying to display Previews of the blocks and failing to detect recursion.

Note: In s.b/wp55/tt1 - with the recursive template parts I'd created for Twenty Twenty-One Blocks it causes Chrome to time out.
image

Clearly there's a problem with the Template parts block ( core/template-part ).
But what should I do as a workaround?

Deliver workarounds to Gutenberg issues as PRs and tidy Fizzie when implemented

To date I've developed local workarounds for a number of issues found in Gutenberg's experimental Full Site Editing solutions.
I summarised the local improvements that I've made so far in #18.

Requirements

In the long term I'd want to see these problems addressed in Gutenberg / WordPress core.
When this has been done, there should be no need for the local workaround.
This issue is to track issues and PRs as they progress through Gutenberg
then to remove the local workaround when it's no longer necessary.

Proposed solution

  • Raise a Gutenberg issue for each problem
  • Implement a PR to fix the issue.
  • Remove the local change when the PR's been merged, or otherwise fixed.

THIS TABLE IS WELL OUT OF DATE - 2022/01/12

Area Fizzie issue Gutenberg issue Gutenberg PR(s) Merged? Removed from Fizzie
core/template-part #1 WordPress/gutenberg#26010 WordPress/gutenberg#26772
core/post-excerpt mentioned in #18 WordPress/gutenberg#26581 WordPress/gutenberg#26806 ( replaces 26785 ) 9.4
core/query-pagination #18 WordPress/gutenberg#26557 ( pre-existing ) WordPress/gutenberg#26831
core/query-loop #11 WordPress/gutenberg#25377 (pre-existing) WordPress/gutenberg#26825
core/template-part postId #1 (comment) WordPress/gutenberg#26734 WordPress/gutenberg#26812
core/template-part wpautop() #20 WordPress/gutenberg#26731 WordPress/gutenberg#26809
core/post-content #7 WordPress/gutenberg#26593 WordPress/gutenberg#26807
core/post-hierarchical-terms #29 WordPress/gutenberg#26851 WordPress/gutenberg#26854 9.4
core/post-content #27 WordPress/gutenberg#26923 WordPress/gutenberg#27012
core/navigation-link #22 site_url part
core/navigation #22 current-menu-item part

Theme without header/footer is deprecated messages

I got these messages trying to user The Events Calendar with the Fizzie theme.

Deprecated: Theme without header.php is deprecated since version 3.0.0 with no alternative available. Please include a header.php template in your theme. in C:\apache\htdocs\wordpress\wp-includes\functions.php on line 4973

Deprecated: Theme without footer.php is deprecated since version 3.0.0 with no alternative available. Please include a footer.php template in your theme. in C:\apache\htdocs\wordpress\wp-includes\functions.php on line 4973

Fatal error: Memory exhausted processing recursive template parts

With the current implementation of Full Site Editing (FSE) in Gutenberg making a stupid mistake such as embedding a template part recursively results in a Fatal error of some form.

image

Simple - trivial - example

Here we see the 404.html page failing to display anything due to immediate recursion on a template part.

404.html contains

<!-- wp:template-part {"slug":"header","theme":"twentytwentyone-blocks","align":"full", "tagName":"header","className":"site-header"} /-->

<!-- wp:template-part { "slug":"issue-27", "theme":"twentytwentyone-blocks"} /-->

<!-- wp:template-part {"slug":"footer","theme":"twentytwentyone-blocks","align":"full","tagName":"footer","className":"site-footer"} /-->

The issue-27 template part contains.

<!-- wp:spacer {"height":70} -->
<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:template-part { "slug": "issue-27", "theme": "twentytwentyone-blocks" } /-->

This is a simple example.

Another simple one is where template part A uses template part B which uses template part A.
It gets more complicated when the template parts are sourced from different places.

Create an Edit link template part

As mentioned in #23 we need the ability to allow an authorsied user easy access to the editor for a displayed post.
This should work for a single post or for any post listed in a query-posts block.

Requirements

  • Ability to display an edit link for the current post
  • Displayed to users who have the authority to edit the post
  • The link text should be (Edit), by default

Proposed solution

In genesis-a2z this was implemented using the [edit] shortcode.
In oik, a similar capability is implemented in the [bw_pages] shortcode as part of the format= parameter.
A value of lower case e causes the [Edit] link to appear for the current post.
It uses the WordPress core function get_edit_post_link()

/**
 * Format the Edit post link (format=e)
 *
 */
function bw_field_function_edit( $post, &$atts, $f ) {
 $link = get_edit_post_link( $post->ID );
 if ( $link ) {
   BW_::alink( "bw_edit", $link, __( "[Edit]", "oik" ) ); 
 }
}

Draft template parts being created unexpectedly

Every now and then, in the Appearance > Template parts list I notice a number of unexpected (no title) - Draft posts created. These are copies of existing posts. But I don't know what caused them to be created.
image

Refactor block-override-functions as extendable classes

For issues #27, #30, and #31, and the original issue #7, I've developed a solution that's not particularly extendable.
I want to deliver my solution as a fix for the issue(s) I've raised on Gutenberg.

But, I don't know how to deliver the solution to Gutenberg such that it can then go into core.

Proposed solution

  • Attempt to refactor the solution using classes
  • Implement classes that extend the base class to produce block specific problem determination support.

Create localized versions of the templates and template parts

Full Site Editing themes should support internationalization (i18n) and localization (l10n).

The process to extract and localize is summarized by this diagram.

screenshot

Requirements

  • To be able to use the Fizzie theme in the user's selected locale.
  • To automatically extract and localize templates and template parts.
  • Test with two additional languages:
  1. UK English - locale en_GB
  2. bbboing's language bb_BB

Proposed solution

  • Create localized versions of the templates and template parts delivered by Fizzie.
  • Use the automated tools developed in bobbingwide/oik-i18n/issues/7
  • Use a batch routine t10n.bat to automate the translation into UK English and bbboing.
  • Update Gutenberg and/or Fizzie to support loading of translated templates and template parts
  • Test for UK English ( en_GB ) and bbboing ( bb_BB ).

Requirements on Gutenberg

  • Gutenberg's template and template loading logic needs to be updated to take into account the user's locale.
  • The translated files will be stored in subfolders of the languages folder, with one directory per supported locale.
  • If the directory isn't present the US English files are used.

Assumptions, scope, exclusions and caveats

  • Templates and template parts are inherently static; they don't implement conditional / looping logic.
  • Internationalization (i18n) of the templates and template parts is only necessary for certain strings which should not be translated.
  • As such, localized versions can be created at build time, or whenever the translations are updated.
  • Blocks used in templates and template parts may implement conditional / looping logic.
  • These blocks are usually server side rendered using PHP.
  • A theme's PHP code will be localized using makepot.
  • Any JavaScript blocks delivered by the theme will be localized using makejson.
  • The solution should support all locales and character sets currently supported by WordPress.
  • The solution should support themes which are not delivered from wordpress.org

Limitations of the prototyped solution

  • t10n.bat is currently dependent upon oik-batch's oik
  • The current routines are prototyped batch routines which echo debug information.
  • Not all scenarios are yet catered for by the routines invoked by t10n.
  • The current solution doesn't merge .pot files into one file prior to translation.
  • But text strings used in PHP and template files and parts are not expected to be the same.
  • So there shouldn't be too many duplicate strings to translate.

Fizzie menu should switch to hamburger style or wrap nicely

The primary menu displayed in the right hand side of the header doesn't behave nicely when the window gets narrower.
Is this something that the block should cater for or is it the theme's responsibility.

image

Options

  1. Allow it to wrap without having the items overlapping.
  2. Switch to a hamburger menu - which is how it's done in genesis-a2z.
  3. Make it horizontally scrollable?

Extract the navigation menus into separate template parts.

While developing the archive.html template file I decided to extract the navigation menus
into separate template parts.
I decided to try two methods.

For the footer menu I extracted the navigation into a footer-menu template part then added this to each template, 9 in all.

<!-- wp:template-part {"slug":"footer-menu","theme":"fizzie" "className":"footer-menu"} /-->

For the header-2-columns template part I'd extract the navigation into header-menu, including this template as an inner block. Fewer changes.

Fatal error: Memory exhausted loading recursive reusable blocks

In Gutenberg there have been at least 3 issues associated with Reusable blocks causing infinite recursion.

WordPress/gutenberg#18704
WordPress/gutenberg#21117
WordPress/gutenberg#22131

The first of these 3 is still open.

I wanted to see if my fix for #27 and #30 could also be applied to issue 18704.

I created a scenario with three reusable blocks named after these issues.

Name Post ID Embeds reusable block
Issue 18704 1134 1133
Issue 21117 1135 1134
Issue 22131 1133 1135

These are in a recursive loop. 1133 -> 1135 -> 1134 -> 1133

I added a reusable block to the 404.html template and achieved the fatal error.
I then overrode the gutenberg_render_block_core_block render_callback
with fizzie_render_block_core_block

function fizzie_render_block_core_block( $attributes, $content, $block ) {
    if ( empty( $attributes['ref'] ) ) {
        return '';
    }
    if ( fizzie_process_this_content( $attributes['ref'] ) ) {
        $html = gutenberg_render_block_core_block( $attributes, $content, $block );
        fizzie_clear_processed_content( $attributes['ref'] );
    } else {
        $html = fizzie_report_recursion_error( $attributes['ref'], 'block' );
    }
    return $html;
}

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.