2

Is it possible to convert an existing Wordpress widget to a block, without having to write a custom block (javascript)?

1 Answer 1

3

The short answer here is no.

Widgets are written in PHP and blocks are written in JavaScript. Beyond that there pretty fundamental differences between the two paradigms in the sense of where they are stored, markup output approaches etc.

You could take the approach of a dynamic block where the block is rendered on the front end with PHP, but you'd still need to register a custom block in JavaScript ( as well as enqueue the files ) to be able to insert it into the Block Editor.

There may be plugins available that solve this, but I am not aware of any.

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.