Block-based “template parts” in traditional themes

Starting in WordPress 6.1, traditional WordPress themes can adopt the usage of 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 template parts in their themes. To enable this feature a theme needs to specify the block-template-parts theme support. The theme developer can add block-based template parts by placing HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. files containing the block template into the /parts folder inside the root directory of the theme.

function add_block_template_part_support() {
    add_theme_support( 'block-template-parts' );
}

add_action( 'after_setup_theme', 'add_block_template_part_support' );

These block-based template parts can now be used in the traditional PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher templates by using the block_template_part function.

Example:

If a theme developer wants to make the site footer editable using blocks, they can create a new file called footer.html inside the my-theme/parts/ directory. This file should contain the default markup of the blocks used to build the footer.

<!-- wp:group {"layout":{"inherit":true}} -->
<div class="wp-block-group">
	<!-- wp:group {"style":{"spacing":{"padding":{"top":"80px","bottom":"30px"}}}} -->
	<div class="wp-block-group" style="padding-top:80px;padding-bottom:30px">
		<!-- wp:paragraph {"align":"center"} -->
		<p class="has-text-align-center">Proudly Powered by <a href="https://wordpress.org" rel="nofollow">WordPress</a></p>
		<!-- /wp:paragraph -->
	</div>
	<!-- /wp:group -->
</div>
<!-- /wp:group -->

To actually use this template part the theme author then needs to call the block_template_part function and pass the name of the template part as the first and only parameter.

<?php block_template_part( 'footer' ); ?>

Props to @mamaduka, @bph, and @annezazu for reviewing this post.

#6-1, #dev-notes, #dev-notes-6-1

Proposal: Amend the Inline Documentation Standards for multi-line comments

This is a small proposal to amend the standards for multi-line comments. The current standards seem to require that multi-line comments have to be done like this:

/*
 * This is a comment that is long enough to warrant being stretched over
 * the span of multiple lines. You'll notice this follows basically
 * the same format as the PHPDoc wrapping and comment block style.
 */

There is also a warning that they must not begin with /** as that is the DocBlockdocblock (phpdoc, xref, inline docs) syntax, and may result in parsing errors.

The proposal is to remove this requirement and to encourage multi-line comments to be done with slashes, same as single-line comments.

// This is a comment that is long enough to warrant being stretched over
// the span of multiple lines. You'll notice this follows basically
// the same format as the single-line comment style.

Reasons:

  • Reduce possibility of typos and eventual parsing errors. This is not just from typing, seems many modern IDEs can auto-complete or auto-correct /* to /** which may lead to more typos.
  • The de-facto JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. coding standard Prettier, and the PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher’s PSR-12 do not enforce specific comment styles.
  • In addition to encouraging typos, the current standard is visually very close to the DocBlock standard which may lead to a moment of confusion when reading the code (uh, is this an incomplete DocBlock that doesn’t have @since and @param?).

#proposal

Editor Chat Agenda: November 30, 2022

Facilitator and notetaker: @fabiankaegy

This is the agenda for the weekly editor chat scheduled for Wednesday, November 30th 2022 at 15:00 CET. This meeting is held in the #core-editor channel in the Making 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/.

General Announcements and Links.

Gutenberg 14.6.1 was released on Nov. 25
Gutenberg Plugin 14.7 RC1 is to be released on Nov. 30, 22

Key project updates

Task Coordination.

Open Floor – extended edition.

If you cannot attend the meeting, you are encouraged to share anything relevant to the discussion:

  • If you have an update for the main site editing projects, please feel free to share it as a comment or come prepared for the meeting itself.
  • If you have anything to share for the Task Coordination section, please leave it as a comment on this post.
  • If you have anything to propose for the agenda or other specific items related to those listed above, please leave a comment below.

#agenda, #core-editor, #core-editor-agenda, #meeting

Devchat agenda, November 30, 2022

1. Welcome

The WordPress Developers’ chat happens every Wednesday in the #core channel of Make 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/. at 20:00 UTC. If you’re keeping track, here’s last week’s summary.

2. Announcements

The final versions of WordPress 3.7 – 4.0 have landed with a notice on each that they are no longer supported. Please encourage your users to upgrade to WordPress 6.1.1, running PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher 8 or later.

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/ 14.7 RC1 will land while devchat is happening. More info to come!

Nominations for the 2023 Core team reps will close Friday.

3. Blogblog (versus network, site) posts of note

From @estelaris, the Docs team is looking for feedback on a second iteration of DevHub’s new look.

From @audrasjb comes the latest A Week in Core.

@azaozz proposes a change to multiline commenting standards.

4. Upcoming releases

The next major is 6.2; the next minor is 6.1.2.

December is a great time to work on the things you would most like to see land in 6.2—before the release cycle ramps up in the new year.

5. Components and tickets

If you’ve got the tickets, the devchat group has the time.

6. Open floor

Add your item to the comments!

#agenda, #dev-chat

Nominations for Core Team Reps: 2023 Edition

This post kicks off the election process with nominations to replace Jb Audras (@audrasjb) and Mary Baum (@marybaum) as CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. team reps. Jb has been in the role for a couple years and Mary for a year, so 2023 marks the time to get new folks to help!

The Role

In the WordPress open sourceOpen Source Open Source denotes software for which the original source code is made freely available and may be redistributed and modified. Open Source **must be** delivered via a licensing model, see GPL. project, each team has on average one or two representatives, abbreviated as reps. Some teams have more than two, but for the sake of sanity sticking with two for now keeps things simpler. And for the historians out there, the role goes way back to 2012.

Historically with the Core team, the team repTeam Rep A Team Rep is a person who represents the Make WordPress team to the rest of the project, make sure issues are raised and addressed as needed, and coordinates cross-team efforts. duration was around a year, though some reps stuck around longer if there was a particularly good fit.

Anyone who serves as a “team rep” is responsible for communicating on behalf of the Core team to the other contributor groups via weekly updates, as well as occasional cross-team chats.  Reps are also consulted on Contributor DayContributor Day Contributor Days are standalone days, frequently held before or after WordCamps but they can also happen at any time. They are events where people get together to work on various areas of https://make.wordpress.org/ There are many teams that people can participate in, each with a different focus. https://2017.us.wordcamp.org/contributor-day/ https://make.wordpress.org/support/handbook/getting-started/getting-started-at-a-contributor-day/., helping find someone within the Core team attending an event who can help lead a Core table.  Full details on the Team Rep role is on the Team Update site.

It is not called “team lead” for a reason.  It’s an administrative role. While people elected as team reps will generally come from the pool of folks that people think of as experienced leaders, remember that the team rep role is designed to change hands regularly.

This role has a time commitment attached to it. Not a huge amount, but it’s at least one or two hours a week.

Here are the main tasks:

How the election works

Please nominate people in the comments of this post. Self-nominations are welcome. The deadline is 2 December 2022.

After that, a poll will be opened for voting. It will stay open for two weeks. The new reps will start their role in January 2023.

If you want to nominate someone in private, please reach out to @audrasjb, @marybaum, or @jeffpaul on 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/..

Disclaimer: if you get nominated, please don’t feel like you have to say yes. The polls will only include the names of the people that are responding positively to a nomination.  So feel free to reply with a “Thank you, but no thank you”.

If you have any questions, please feel free to ask in the comments. Finally for reference, here are the 2020 and 2021 nomination posts.

Thanks to @marybaum for co-authoring and to @jeffpaul for reviewing this post.
Special thanks to @webcommsat who helped a lot the current team reps on a number of tasks this year.

#team-reps

Performance Chat Summary: 15 November 2022

The full chat log is available beginning here on Slack.

Announcements

  • Excellent update on the 6.1.1 release, which is going out today12 out of the 30 tickets in the 6.1.1 release are focused on performance! That is a great outcome and a testament to the team’s hard work on addressing some of the follow up quirks around 6.1 performance

Focus area updates

Images

@adamsilverstein @mikeschroder

GitHub project

Feedback requested

Object Cache

@tillkruess @spacedmonkey

GitHub project

  • @spacedmonkey: No updates on object caching, has been focusing on 6.1.1 and theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML.
    • A lot of theme.json parsing APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. have very serious performance issues
    • We have fixed a couple of them and they are making the way in 6.1.1
    • Another very relevant ticketticket Created for both bug reports and feature development on the bug tracker. is #57077 and #57114
  • @OllieJones: has a prototype of SQLite3 persistent object cache cooking; will make a module proposal soon (basically use SQLite for object caching rather than the main DB)
    • @flixos90: I wonder how much that overlaps or potentially conflicts with the proposal to use SQLite as database
    • @aristath: No overlap or conflictconflict A conflict occurs when a patch changes code that was modified after the patch was created. These patches are considered stale, and will require a refresh of the changes before it can be applied, or the conflicts will need to be resolved.… But they can definitely be combined for a performance boost
    • @flixos90: If a site can benefit from an SQLite DB speed and we implement that feature reliably, why would you not want to use that but then use it for an object cache?
    • @OllieJones: there are many installations that could benefit from a persistent object cache 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, without requiring a port of the main data to SQLite. And backup / redundancy / infrastructure would not need to change
    • @flixos90: The idea sounds very useful to me especially given wider support of SQLite, but I would still like to explore a better answer on balancing this “SQLite as cache” project with the “SQLite as DB” project and the tradeoffs between the two

Feedback requested

Measurement

N/A

GitHub project

  • No updates

Feedback requested

JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. & CSSCSS Cascading Style Sheets.

@aristath @sergiomdgomes

GitHub project

Feedback requested

Database

@olliejones

GitHub project

  • @aristath: SQLite PR is ready for another round of tests and reviews
    • @flixos90: reviewed it a few times and it looks excellent to me. Some quirks to still address mostly. One thing I still want to explore a bit more is trying to figure out a way to have the SQLite DB prepopulated so that you don’t end up on the WP Install screen after updating the module; this wouldn’t be a blockerblocker A bug which is so severe that it blocks a release., but it would make the user experience a whole lot smoother
    • @flixos90: I would suggest we polish this over the next week and aim for a merge within the next 2 weeks? This way we can publish the first version in the upcoming Performance Lab 1.8.0 release mid December
  • @aristath will work on drafting a Make CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. post on the SQLite module for once it’s in the Performance Lab plugin
    • @flixos90: Best to draft it soon, so that we can review and finalize it early; this way we can publish it immediately the same day that that release will go out (December 19)

Feedback requested

Infrastructure

@flixos90

GitHub project

  • @flixos90: Next Monday we’ll have the Performance Lab 1.7.0 release
    • At the moment, there are still 5 PRs in the milestone which need to be committed or punted by tomorrow
    • @mukesh27: PR #582 is ready for your review
      • @flixos90: Looks like that PR tackles a bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. that #578 also focuses on (although that one does a bit more)
    • @flixos90: Given the size of the database health checks PR, I think it’s a bit too early (or too late, if you look at it from another angle) to merge it this short before the release, also since it’s a new module
      • @OllieJones: ok. let’s puntpunt Contributors sometimes use the verb "punt" when talking about a ticket. This means it is being pushed out to a future release. This typically occurs for lower priority tickets near the end of the release cycle that don't "make the cut." In this is colloquial usage of the word, it means to delay or equivocate. (It also describes a play in American football where a team essentially passes up on an opportunity, hoping to put themselves in a better position later to try again.) it; will iterate on it so maybe we can merge it in the next few weeks for 1.8.0
    • @mehulkaklotar: PR #571 is under reviews right now, we will be able to merge it before tomorrow
    • @pbearne: I believe they are ready but will check

Feedback requested

Open floor

  • @OllieJones: I’d like to see w.org sign up for the https://greensoftware.foundation/
    • @flixos90: What kind of effort or commitment does that entail? As mentioned on the issue that you opened about this, this would probably be best to move forward with a Make Core post proposing it; getting a sense of interest at a larger scale is one reason I’d propose writing a Make Core post

Our next chat will be held on Tuesday, November 22, 2022 at 16:00 UTC in the #core-performance channel in Slack.

#core-js, #core-media, #performance, #performance-chat, #summary

Performance Chat Agenda: 22 November 2022

Here is the agenda for this week’s performance team meeting scheduled for November 22, 2022, at 16:00 UTC.


This meeting happens in the #core-performance channel. To join the meeting, you’ll need an account on the Make WordPress Slack.

#agenda, #meeting, #performance, #performance-chat

Performance Chat Summary: 22 November 2022

The full chat log is available beginning here on Slack.

Announcements

  • @clarkeemily thanked the team for the 1.7.0 release yesterday

Focus area updates

Images

@adamsilverstein @mikeschroder

GitHub project

  • No updates

Feedback requested

Object Cache

@tillkruess @spacedmonkey

GitHub project

Feedback requested

Measurement

N/A

GitHub project

  • No updates

Feedback requested

JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. & CSSCSS Cascading Style Sheets.

@aristath @sergiomdgomes

GitHub project

  • No updates

Feedback requested

Database

@olliejones

GitHub project

  • @aristath continues to refine the SQLite module, and it’s pending a review so we can merge it
  • @aristath started working on a draft post to publish on make when the SQLite module gets merged, to invite testers.
  • @aristath having difficulty running performance A/B tests for the WP-CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. classes autoloader POC. This one is going to take some more time.
  • @OllieJones has been working on an sqlite-object-cache 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 (see repo). He mentioned it in last week’s meeting, but the question is whether we want to include this as a module in the performance-lab plugin. Right now it’s standalone and works perfectly fine. My personal opinion is it should be considered as a module… SQLite is universal and can therefore be used in Core to improve performance as a caching mechanism.

Feedback requested

Infrastructure

@flixos90

GitHub project

  • No updates

Feedback requested

Open floor

  • @oandregal asked: for folks working around wp_get_theme etc. Wanted to share a cross-PRs comment. I’m having troubles following direction regarding whether or not to use wp_get_themeThis PR proposes removing it from some places (backports changes from core), while these other two proposes to add it to a few hotpaths. Would you mind clarifying direction and nuances in this thread? Thank you.
    • @spacedmonkey has replied on the PR
    • @flixos90 also advised his response would be the same, we want to avoid calling wp_get_theme() multiple times where it can be called once instead. It’s not that we shouldn’t use the function anymore, just be conscious of limiting its usage to when it’s necessary
      • @10upsimon Perhaps a discussion for elsewhere @flixos90 but has there been consideration for a singleton instance response? i.e wp_get_theme() returns a singleton instance ( ::get_instance()) as opposed to instantiating a new class with each function return statement? Is there ever a valid cause for re-instantiating the WP_Theme class? I’m sure it’s far more complex and involved than I make it out to be, and I’d assume that this has been considered.
      • @spacedmonkey and @flixos90 advised we shouldn’t use singleton. But even if we use a global, there is a potential risk: Object instances are mutable so if any change was made on one instance returned from the function, it would affect every other instance if we went with a scenario where no new entity was returned on every call. For the most part this could be a backward compatibility break. So I’m not really sure this would be a worthwhile effort
  • @clarkeemily Just to call out there are currently 15 open issues marked as ‘Needs Review‘ across all focus areas and please keep an eye out for any PRs that may need review alongside these
    • @cpal I’ve recently been looking for ways we can leverage our in-house performance/load/functional testing solution at Pressidium® to help out the core-performance team in whatever way we can but I haven’t found something totally relevant just yet. I’m happy to share details on what we currently have available in the testing realm and what is yet to come.
      After having a brief into chat with @aristath, I believe we may be able to get something going with some of the work he is currently tackling after some further discussion.
      What do you all think?? Help a noob out that’s eagerly looking to find his footing in the WP Community by throwing out some relevant suggestions if-ever/whenever you can!
      • @adamsilverstein asked if a brief overview could be provided on testing in the context of WordPress Performance
      • Pressidium is a managed/HA hosting provider and I’m tasked with performance testing that we currently use to test out client sites and services depending on the needs on the client but since we went through (and are continuing with) developing a testing infrastructure we want to give back to the WP community with it all.
      • Further discussion / introduction ongoing here in the 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/. chat

Our next chat will be held on Tuesday, November 29, 2022 at 16:00 UTC in the #core-performance channel in Slack.

#core-js, #core-media, #performance, #performance-chat, #summary

Performance Chat Agenda: 29 November 2022

Here is the agenda for this week’s performance team meeting scheduled for November 29, 2022, at 16:00 UTC.


This meeting happens in the #core-performance channel. To join the meeting, you’ll need an account on the Make WordPress Slack.

#agenda, #meeting, #performance, #performance-chat

Performance Chat Summary: 29 November 2022

Meeting agenda here and the full chat log is available beginning here on Slack.

Focus area updates

Images

@adamsilverstein @mikeschroder

GitHub project

Feedback requested

Object Cache

@tillkruess @spacedmonkey

GitHub project

Feedback requested

Measurement

N/A

GitHub project

  • No updates

Feedback requested

JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. & CSSCSS Cascading Style Sheets.

@aristath @sergiomdgomes

GitHub project

  • No updates

Feedback requested

Database

@olliejones

GitHub project

  • @mxbclang: What are the next steps on Revisit indexes for DB performance #132?
    • @olliejones: Current voting winner points to doing something dbms-version-specific to the schema, eventually in coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress., think we can do this in the 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 if we’re willing to accept a mu-plugin drop-in module. Disadvantage here is complexity.
    • @flixos90: This is tricky – we have a voting winner, but also some strong opinions from different sides including a WP lead developer.
    • @mxbclang: Seems like the best next step here would be to close out the vote as planned but hold on next steps pending further discussion in the issue, then regroup on this in a future chat
    • All agreed; vote will close and @mxbclang will add a comment about next steps
  • @olliejones: SQLite Object Cache is coming along nicely; will create a new module proposal issue once it’s closer to complete
  • @olliejones: For future discussion: Do we need some sort of formal set of filters, etc. to support the big competent hosting providers in this back-end area?

Feedback requested

Infrastructure

@flixos90

GitHub project

  • @flixos90: Been working on iterating on the Server-Timing API PR. Still in draft because unit tests need to be added, but ready for review. Would love feedback and opinions on the APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. implementation. The most important recent change is that it is now initialized early through a drop-in, so it can capture measurements that happen before WP plugins are loaded.

Feedback requested

Open floor

  • @olliejones: There’s a sustainability team forming – see #sustainability Slack channel
  • @nickchomey: Been working on implementing a real PWA for a site under development. Plugin options are limited right now but @westonruter‘s plugin is the right approach. Is this something that the performance team can move forward?
    • @flixos90: Not sure what the current state of the plugin is; original idea was for it to be a feature pluginFeature Plugin A plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins.
    • @nickchomey: Proposing a real coordinated effort be made to improve it to the point that it could be merged into core
    • @flixos90: It could definitely be feature plugin material, but as always it requires resources. If a small group is up for tackling, we would be supportive and help here possible.
    • @westonruter: The plugin is stable and essentially in maintenance mode. Not clear if there is the 80% user benefit to justify core merge just yet. See discussion between @nickchomey and @westonruter in GH issue: https://github.com/GoogleChromeLabs/pwa-wp/issues/884.
    • @flixos90: Key aspect of proposing this for core would be to come with an actual usage of PWA capabilities that immediately benefits core users
    • @westonruter: Benefit that all users could get now is offline browsing on the front-end, but there’s a separate concern of what happens when a large portion of the web is registering service workers
    • @pbearne: Aren’t we going to need something like this for real-time multi-editing in 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/?
    • @olliejones: Maybe the Twenty Twenty Four theme could be made PWA-friendly?

Our next chat will be held on Tuesday, December 6, 2022 at 16:00 UTC in the #core-performance channel in Slack.

#core-js, #core-media, #performance, #performance-chat, #summary, #hosting-community

#meta