Meeting notes Tuesday 7th of July 2020

The recap of the meeting is below and you can read the meeting transcript in the slack archives (a Slack account is required).

Weekly Updates

In the past seven days:

  • 257 tickets were opened
  • 275 tickets were closed:
  • 254 tickets were made live.
  • 20 new Themes were made live.
  • 234 Theme updates were made live.
  • 2 more were approved but are waiting to be made live.
  • 21 tickets were not-approved.
  • 0 tickets were closed-newer-version-uploaded.

The current waiting time for new themes is 4 weeks. 73 themes are in the new queue.

Using reusable blocks to ease the transition to blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. based themes

@aristath Has written a post about using reusable blocks outside the content.

Reusable blocks can be used as a stepping stone for themes that want to make use of the block editor for headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes./footer/sidebars etc. before FSE is officially released.

It was suggested during the chat that theme authors should try full site editing instead of a temporary solution. Full site editing is not stable enough to be used in production, but reusable blocks are stable and can be used with existing themes.

Theme uploads that are blocked by Theme Check because of their images

Older themes with images from Unsplash and Pixabay, where the images were added to the theme before the website’s license change, have been blocked by Theme Check when uploaded to the WordPress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ theme directory.

The check in Theme Check does not only prevent the images but the use of the word Unsplash. Related: https://github.com/WordPress/theme-check/issues/259

It was decided that Theme Check will be updated to no longer block the images. This is a very small code change.

Allowing themes to place their admin page outside the appearance menu for increased visibility

This topic arose from a question about whether themes are allowed to add a panel with information to the block editor sidebarSidebar A sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme./tools panel. This is not allowed.

To keep the editor free from clutter, advertising and upsell, with the customizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. being used less, and no dashboard widgets being allowed, can we give theme authors a better place to include their information, and limit upsell to that area?

If a top level menu item would be allowed, these restrictions were suggested:

  • No priority may be used.
  • No UIUI UI is an acronym for User Interface - the layout of the page the user interacts with. Think ‘how are they doing that’ and less about what they are doing. or color changes are allowed for the menu item.
  • The title must be kept short and not include spam.
  • If a custom icon is used it must be a single color.
  • No more than 3 subpages.

A longer more heated discussion took place after the meeting, and the decision was postponed. A new post will be created on the teams make blog to discuss it further.

We want to remind everyone that the requirement for not adding any obtrusive upsell is still in place.

How do we best handle updates to themes that have not been updated in two years?

Updates to themes that had not been updated in two years used to “get stuck” because reviewers were not able to see that they did not go live automatically.

We now have these updates listed in their own queue on the themes TracTrac Trac is the place where contributors create issues for bugs or feature requests much like GitHub.https://core.trac.wordpress.org/. https://themes.trac.wordpress.org/report/1 And while the new queue is 4 weeks, this queue is 3 months.

  • There are not enough reviewers to cover all queues.
  • Theme authors may not be aware that their update is not going live automatically
  • Theme authors may not be aware of that old themes has to follow the current requirements.

It was suggested that these themes should be set live, and there was a short discussion about if it was safe to set them live. It is common for these themes to not follow the current requirements.

The discussions resulted in no changes being made to the queue. We need to remind theme reviewers to also review themes from this queue.

Update on the navigation block/navigation screen

The navigation block and navigation screen will not be ready in time for WordPress 5.5. Please help test these features.

There is a new meeting about navigation on Wednesdays at 07:00 UTC in the #core channel on the WordPress slackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/..

@aristath Has created and written about a menu filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. that helps theme authors add markup and CSSCSS CSS is an acronym for cascading style sheets. This is what controls the design or look and feel of a site. classes used by the block to the current nav menu.

This will help theme authors use the same styling for their current navigation and the navigation block.

It was suggested during the navigation meeting that the Navigation block should output markup that is as identical as possible to existing menus.

Date and time of the next meeting

It was agreed that the next team meeting will be on Tuesday, August 4th, 2020 at 1700 UTC.

#themes-team

X-post: External Linking Policy – “Commercial blogs”

X-post from +make.wordpress.org/docs: External Linking Policy – "Commercial blogs"

Printing navigation-block HTML from a legacy menu in themes

Full-Site Editing (or FSE for short) is scheduled to be released with WordPress 5.6. In the meantime, the GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party includes a Navigation BlockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. that theme-authors can use to experiment and preview what their navigation will look like once users are able to use FSE on their sites.

You can already start preparing for this shift by making the default WordPress navigation use an HTMLHTML HTML is an acronym for Hyper Text Markup Language. It is a markup language that is used in the development of web pages and websites. structure similar to what the Navigation block is going to print.

To do that, you can paste the following code in your theme’s functions.php file:

/**
 * Filters the CSS class(es) applied to a menu list element.
 *
 * @param array $classes Array of the CSS classes that are applied to the menu `<ul>` element.
 * @return array
 */
add_filter( 'nav_menu_submenu_css_class', function( $classes ) {
    return [ 'wp-block-navigation__container' ];
} );

/**
 * Filters the CSS classes applied to a menu item's list item element.
 * 
 * @param array $classes Array of the CSS classes that are applied to the menu item's `<li>` element.
 * @return array
 */
add_filter( 'nav_menu_css_class', function( $classes ) {
    $item_classes = [ 'wp-block-navigation-link' ];
    if ( in_array( 'current-menu-item', $classes ) ) {
        $item_classes[] = 'current-menu-item';
    }
    if ( in_array( 'menu-item-has-children', $classes ) ) {
        $item_classes[] = 'has-child';
    }
    return $item_classes;
} );

/**
 * Filters the HTML attributes applied to a menu item's anchor element.
 * 
 * @param array $atts The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
 * @return array
 */
add_filter( 'nav_menu_link_attributes', function( $atts ) {
    $atts['class'] = 'wp-block-navigation-link__content';
    return $atts;
} );

/**
 * Filters a menu item's title.
 * 
 * @param string $title The menu item's title.
 * @return string
 */
add_filter( 'nav_menu_item_title', function( $title ) {
    return '<span class="wp-block-navigation-link__label">' . $title . '</span>';
} );

/**
 * Filters a menu item's starting output.
 * 
 * Append the dropdown arrow to links with submenus.
 * 
 * @param string   $item_output The menu item's starting HTML output.
 * @param WP_Post  $item        Menu item data object.
 * @return string
 */
add_filter( 'walker_nav_menu_start_el', function( $item_output, $item ) {
    $has_children = in_array( 'menu-item-has-children', $item->classes );
    if ( $has_children ) {
        $item_output = str_replace(
            '</a>',
            '</a><span class="wp-block-navigation-link__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" transform="rotate(90)"><path d="M8 5v14l11-7z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span>',
            $item_output
        );
    }
    return $item_output;
}, 10, 2 );

Then to print the navigation you can use the following in your header.php file:

<nav class="wp-block-navigation" role="navigation">
	<ul class="wp-block-navigation__container">
		<?php
		wp_nav_menu(
			array(
				'container' => '',
				'items_wrap' => '%3$s',
				'theme_location' => 'primary',
			)
		);
		?>
	</ul>
</nav>

This will allow you to see what the future structure of navigation will be in WordPress themes and you can start converting your styles & scripts accordingly to accommodate these changes and be ready for when they land in WordPress CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress..

Using the block editor for theme-parts

Full Site Editing (FSE for short) is scheduled to be included in WordPress 5.6 in a few months. In case you are not aware of what FSE is, it’s an effort to bring the BlockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. Editor to all areas of a site, including the site headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes., footer, sidebars and everything in between.

Reusable Blocks are a pretty neat and relatively underestimated feature of the Block Editor that can allow you to implement these things in your theme now, easing the transition to a full-fledged editing experience.

The idea is this: You can create a reusable block for your site’s header or footer, and inject that where your normal theme’s header or footer would be. Reusable blocks are a separate post-type called wp_block and can be queried like any other post-type, so you can do pretty much anything you want with them.

Below I’m going to share some example code snippets that you can use & modify to suit your needs. The examples will be for a header, but you can duplicate the same logic for footers, sidebars and so on.

First, we’ll need a function that will check if a reusable-block with that title exists. If it does exist we’re going to print its content, and if it doesn’t exist we’re going to return false to make things easier down the road:

/**
 * Prints the header reusable block.
 * If a "site-header" reusable-block doesn't exist, return false.
 * 
 * @return bool
 */
function my_theme_the_header_reusable_block() {

	// Run the query.
	$posts = get_posts( [
		'post_type' => 'wp_block',
		'title'     => 'site-header',
	] );

	// If a block was located print it and return true.
	if ( $posts && isset( $posts[0] ) ) {
		echo do_blocks( $posts[0]->post_content );
		return true;
	}

	// If we got this far the header block doesn't exist.
	// Return false.
	return false;
}

Next, we’re going to add a function to print the contents of that 1st function. If a block doesn’t exist, we’re going to print a fallback header by calling get_template_part( 'fallback-header' ), and then we’ll add a message urging the site-admin to create a new header. This way users won’t start wondering “why is there no header”, they can just click a link and create one:

/**
 * Print the header content.
 * 
 * If a "site-header" reusable block exists we print its contents here
 * otherwise add a link so admins can create a new header.
 */
function my_theme_the_header() {
	?>
	<header>
		<?php // Print the header. If one doesn't exist, print custom content. ?>
		<?php if ( ! my_theme_the_header_reusable_block() ) : ?>
			<?php get_template_part( 'fallback-header' ); ?>
			<?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
				<p>
					<?php esc_html_e( 'It looks like you have not yet created a header for your site.', 'textdomain' ); ?>
				</p>
				<p>
					<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wp_block&post_title=site-header' ) ); ?>">
						<?php esc_html_e( 'Create a new header', 'textdomain' ); ?>
					</a>
				</p>
			<?php endif; ?>
		<?php endif; ?>
	</header>
	<?php
}

When they click on the link generated from this function, users will be redirected to a page where they can add the contents of their header, and to make things easier the site-header title is already filled-in for them.

The above 2 functions can be included in our theme’s functions.php file, or anywhere else we want them depending on the theme’s structure.

To print this user-created header in our theme we’ll just have to go in our header.php file and call the my_theme_the_header() function.That’s all there is to it!

We can further improve the my_theme_the_header() function by adding a permission check to make sure the user can create a block before we add the link (EDIT: Permission check added to the code snippet above), and we can even add an edit link so site-owners can go to the header’s edit screen, but for the sake of this post we’re keeping things simple and open to your improvements.

Why this is important:

Using the technique above, existing themes can leverage the block editor for all things instead of being limited to the content area.

Using reusable blocks is a good way to get ready for Full-Site Editing and will be easier to transition to a new block structure. You can start exploring options, you can even start transitioning your existing headers to a block structure and use them as a fallback, combining them with the “Create a new header” link from the above example.

When FSE gets released, a theme that was previously using a reusable-block for its header will be a lot easier to transition to the new structure since the header will already be there in a proper blocks format.

Themes Team Meeting Agenda for July 7

The themes team conducts a meeting on the second and fourth Tuesday of the month, and once per month during the summer and holiday periods.

Along with the fixed agendas, we have an open floor at the end where you can ask or share anything related to themes.

We encourage all members and anyone interested to attend.

Channel: #themereview | Time: Tuesday, July 7 2020, 17:00 UTC

Meeting Agenda

  1. Weekly Updates
  2. Using reusable blocks to ease the transition to blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. based themes
  3. Old themes with images that are not compatible with GPLGPL GPL is an acronym for GNU Public License. It is the standard license WordPress uses for Open Source licensing https://wordpress.org/about/license/. The GPL is a ‘copyleft’ license https://www.gnu.org/licenses/copyleft.en.html. This means that derivative work can only be distributed under the same license terms. This is in distinction to permissive free software licenses, of which the BSD license and the MIT License are widely used examples. due to license changes are blocked by Theme Check. What is the correct way to handle these images?
  4. How do we best handle updates to themes that has not been updated in two years?
  5. Date and time of the next meeting

The discussion about the meeting agenda can be held in the comments below. You are encouraged to propose topics.

Meetings usually last around 90 minutes.

Attend and share your valuable feedback and suggestions.

#agenda, #meeting, #themes-team