I would like to create a custom block preview for my block “project-munich.php”.
I followed the steps from the docs and created a folder “project-munich” in my plugins folder and 3 files in it (index.css, index.js, index.php). For testing, I put in the expample code from the docs.
Now, the only thing which seems to work is the css as I changed the target to all divs to see, if the button border is added to the block preview – and it works.
But I think, the js and php file are not connected to it…
Is there anything wrong in my files ?
Thanks in advance!
oh yes you’re right, I saw on a different post that this is the syntax in the js for adding sections in the preview. I want the preview to display an image, the title and the date out of the block… is that even possible?
Thanks @moonwalk, for me as a beginner it was a bit confusing… I tried to recreate the example in the docs with the button block and now it works but the preview is just shown inside the block (image 1).
In the block overview where all blocks are listed, I cannot see the correct preview yet… (image 2)
How can I adjust this?
image 1 (when I adjust the block):