• Hello there,
    Im trying to develope some wordpress blocks but I cant figure out what is missing with my dynamic block.
    Here is what I have done:

    1. Started with the command:
    npx @wordpress/create-block –variant dynamic block-name –no-plugin

    2. Edited the render.php file which is created by the command.

    3. npm start

    From my understanding the block is now getting build. All files are generated into the build folder except the render.php file.
    Inside the block.json there is the line:
    “render”: “file:./render.php”

    If I create the file render.php inside the build file its working and the frontend displays the render.php. But shouldnt the file get moved from the script? Also I dont want to make the changes inside the build folder. Something is missing I guess.

    Thanks for your help!


Viewing 1 replies (of 1 total)
  • It looks like you are using the @wordpress/create-block tool to create a dynamic block, which allows you to use PHP to render your block in the WordPress editor and on the front end of your site.

    The npm start command is used to start a development server, which allows you to see your changes as you make them in the block. It does not build the block for production. To build the block for production, you can run the npm run build command. This will create a production-ready version of your block in the build folder.

    If you want to include the render.php file in the production build of your block, you need to ensure that it is included in the src folder. The @wordpress/create-block tool should have created this folder for you.

    If you want to make changes to your block and see them reflected in the production build, you need to run the npm run build command after making your changes. This will update the production build of your block with the changes you made.

    I hope this helps! Let me know if you have any other questions.

Viewing 1 replies (of 1 total)

The topic ‘Dynamic Block render.php not moving to build’ is closed to new replies.