New Comment-Related Blocks Arriving With WordPress 6.0

New Comment-Related Blocks Arriving With WordPress 6.0

WordPress 6.0 will attempt to tackle comments lists via the block system. It is an area that has fallen behind other features, which have received the bulk of the work in prior releases.

Last week, JuanMa Garrido called for volunteers to test the new blocks via the Make WordPress Test blog. Contributors are asked to leave feedback in the comments or create new issues via the Gutenberg GitHub repository.

Post comments lists have undergone a few changes over time. Before WordPress 2.7, theme authors used a PHP foreach call to loop over a comment objects array directly in their theme’s comments.php template. It was a simple system of basic HTML and a few template tags scattered throughout. It worked well until the introduction of nested replies. There was a mad scramble from developers and users alike to update themes to use the new wp_list_comments() function.

Fast forward to the era of block templates and the site editor. Once again, comments changed, but it was only on the surface. The Post Comments block was merely a wrapper for the existing implementation. Any block theme author has had to use custom PHP filters to modify the output of the comments list, and users were mostly out of luck altogether outside of a few design controls.

WordPress 6.0 will almost bring us full circle. Comment output is returning to templates via the block system. PHP filters are no longer required to move the layout around. And users can make modifications via the site editor.

Admittedly, I had not spent much time working with comment-related blocks before today. For the most part, I have avoided them altogether because I was awaiting the set of blocks expected to land with WordPress 6.0.

The latest version of the Gutenberg plugin ships an entire suite of blocks specific to comments. Comments Query Loop and Comment Template should work similarly to their post counterparts. The set includes several metadata-related blocks for the comment author, date, reply link, and edit link. There are a few new ones for pagination, and the upcoming Avatar block will also work inside the Comment Template.


Laisser un commentaire