The HTML block is only for HTML code – not for PHP code as you write it here.
What is the concrete goal of what you want to achieve with it? Maybe it can be solved better in a completely different way.
Thanks for the reply. I want the user of the page, to type in input data and then do a database table query on the server and display the result on the website. The database table is not the standard posts etc. of which there many examples. It is a table with scheduled time slots, so it is not part of the WordPress database structure. In other words, the database table could be any available resource. At this stage, it is a lookup only. Maybe later it could be a booking and reservation of a resource i.e. update of the “external” database. Maybe a plugin would be my solution? Strange enough, the PHP code works for returning a literal constant, to the Custom code block (referring to “<div>whatever</div>” ).
-
This reply was modified 2 years, 11 months ago by
Paul Roos.
-
This reply was modified 2 years, 11 months ago by
Paul Roos.
You should develop your own plugin for your project. This can realize the processing of the entered data as well as the access to the individual database tables. For the integration in the frontend you could use shortcodes, which could also control the output. Or you could develop your own Gutenberg blocks, if you want it to look “nice” for editors.
Thank you. I was looking for a “quick” solution.