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

Fix default theme supports #2029

Closed

Conversation

noisysocks
Copy link
Member

By default, block themes should have a few theme supports enabled by default. These are: post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links.

This is a backport of WordPress/gutenberg#35593.

Trac ticket: https://core.trac.wordpress.org/ticket/54597


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

By default, block themes should have a few theme supports enabled by
default. These are: post-thumbnails, responsive-embeds, editor-styles,
html5, automatic-feed-links.

This is a backport of WordPress/gutenberg#35593.
@noisysocks
Copy link
Member Author

I tried adding a unit test for this but couldn't quite figure it out. Perhaps it's not possible because setup_theme is called during bootstrap. Any advice on that is welcome.

add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
add_theme_support( 'html5', array( 'style', 'script' ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to extend the HTML5 support for other elements too. At least for components which are used by blocks like comment-form/comment-list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think @youknowriad? I'm just copying over what's already in the plugin 😀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also just copied what the themers suggested from 2022 theme. that said IMO, everything should be supported. Can we do * or something like that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said IMO, everything should be supported. Can we do * or something like that?

No, add_theme_support( 'html5', ... ) intentionally requires an array of specific types to check, see this comment for context, and some more history in the description of https://core.trac.wordpress.org/ticket/51657.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the reasoning there though?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should we do in the short term for 5.9?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can land this as is or by adding as much elements as available to at least be on the same page as the Gutenberg plugin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in #2029 (comment), we only have to add the two for the comments blocks.

Suggested change
add_theme_support( 'html5', array( 'style', 'script' ) );
add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'style', 'script' ) );

search-form, gallery, caption, and navigation-widgets (not 100% sure) seem to be irrelevant for block themes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, declaring the support of navigation-widgets currently doesn't change anything to the markup of the navigation widgets (page/category list, etc).

It's supposed to add a <nav> container to the widget. This should probably be reported upstream since it's a regression from Classic themes. I'll open an issue on Gutenberg for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocean90 can you add those 2 https://github.com/WordPress/wordpress-develop/pull/2029/files#r766453524 upstream in Gutenberg please? Will go ahead with the suggestion here. But needs to be synched with Gutenberg too.

Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants