
On 12 February the final version of GenerateBlocks 2.0 (GB) was released after a long cycle that started on 24 November 2024 with its first alpha.1 version, which I have been testing since the beginning.
Version 2.0 is one of those that hides great improvements "under the bonnet" to keep sites well optimised. Version 2.0 allows you to keep version 1.0 blocks or even revert to them if you need to.
Although they are still fine-tuning the final performance and usability is still their unfinished business, with a steep learning curve as they don't seem to have found the "visual" balance of the block configurations yet, this is compensated by an impeccable support and a very complete documentation.
This block plugin, created by Tom Usborne, is very young. It is just over two years old. Its 1.0 version was released on 30 August 2022.
This has not prevented it, together with GeneratePress (GP), from becoming the ideal combo for designing and/or building part or almost all of your WordPress design, as it offers a clean, light and fast code. To this day it is still chosen by a large number of WordPress users, from "niche" to home bloggers.
We must insist that GenerateBlocks is not a builder, like Elementor or other so-called "Site Builders" although it can be used as such, it is a different approach that has nothing to do with the traditional "drag and drop". It is a block plugin.
If there is one thing that is fair to review and applaud about GB+GP, it is their support. They have understood their users very well and they have hit the nail on the head when it comes to customer service. From their support forum you can solve almost anything.
They help you even with issues that are not always related to errors or doubts about the use, they also help when it comes to building or redesigning specific things. Always with a friendly and resolute treatment. And the best thing is that all these queries, discussions and solutions can be consulted by anyone, even if they don't use their paid versions.
This alone is worth every dollar you pay for your template and block plugin.
I leave here, as a reminder and "reconsultation" for the future, an example of a solution (and it is not the first) of one of these queries in your support forum that allowed me to translate some strings dynamically. They were the last ones to be translated and they were resisting.
Most probably, for someone with programming knowledge it's like scratching their nose, but for advanced tinkerers with basic knowledge, like me, it's a real gift.
Translating text from a GenerateBlocks "Text" block using Polylang
The Polylang plugin allows you to register strings to add their corresponding translations wherever you want. To do this just add the strings like this to the theme's functions.php:
pll_register_string('Publicado:', 'Published:');
pll_register_string('Actualizado:', 'Updated:');
Thus, they will already appear for translation in a group called Polylang under Languages/translations:

But this is not enough, now you have to invoke each of these translations with PHP code in order to display them.
The mission is to translate dynamically into each language the strings Published: and Updated: that I added at the time in a GP Element with a GB 2.0 "Text" block (formerly called "Headline").
Structure of the GB Text block
Publicado: {{post_date}} | Actualizado: {{post_date type:modified}} |

The problem is that I couldn't find a way to add the PHP Polylang calls to replace those two words depending on the language in which the page is displayed:
<?php echo pll__('Published:'); ?>
<?php echo pll__('Updated:'); ?>
The GB block does not execute PHP code and there was no possibility to put it in with a shortcode. At this point I declared myself unable to find a solution and decided to consult the support forum.
And after a few messages, the solution arrived.
1. A CSS class is added to the Text" block. For this example we use: my-post-dates

2- This filter is added in the functions.php of the template:
add_filter( 'render_block', function( $block_content, $block ) {
if ( ! empty( $block['attrs']['className'] ) && 'my-post-dates' === $block['attrs']['className'] ) {
$published = pll__('Published:');
$updated = pll__('Updated:');
// Ensure these values are translated, fallback to default if empty
$translated_published = !empty($published) ? $published : 'Published:';
$translated_updated = !empty($updated) ? $updated : 'Updated:';
$block_content = str_replace('Publicado', $published, $block_content);
$block_content = str_replace('Actualizado', $updated, $block_content);
}
return $block_content;
}, 10, 2 );
And that's it. Now, those two words will be displayed in the language selected from the ones you are using.
This post contains two affiliate links.