JavaScript for WordPress Forums Gutenberg Development Re-branding the example plugin

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #38025
    munirkamal
    Participant

    Hey Zac,

    I am trying to rebrand the example plugin. I replaced all the instance of “jsforwp” with something else and I am getting errors and also blocks doesn’t appear in editor. Could you please guide on this?

    Regards,
    Munir

    #38035
    Zac Gordon
    Keymaster

    Interesting. So I just looked through the source and doing find and replace on “jsforwp” turns up

    – CSS Style, fine
    – Block names and namespace, should be fine
    – Enqueue function calls and names, should be fine

    My thoughts would be this.. Mmm…

    – Check for any errors, of course
    – Try wiping the bundled code and run a clean npm run build, just to try
    – Try changing it back and see if it works again. If it works you have to gradually go through and change on smaller scope first

    If you do a find all in your app do you see anything different that was affected? Were there any errors displaying at all?

    #38038
    munirkamal
    Participant

    Hi Again,

    Thank you for your response. I’ve almost made it work. with one issue only which is related to dynamic blocks. After the change I am getting this error.

    Fatal error: Uncaught Error: Call to undefined function register_block_type() in /app/public/wp-content/plugins/blocks-ultimate/jsforwp-blocks.php:137 Stack trace: #0 /app/public/wp-settings.php(305): include_once() #1 /app/public/wp-config.php(87): require_once('/app/public/wp-...') #2 /app/public/wp-load.php(37): require_once('/app/public/wp-...') #3 /app/public/wp-admin/admin.php(31): require_once('/app/public/wp-...') #4 /app/public/wp-admin/plugins.php(10): require_once('/app/public/wp-...') #5 {main} thrown in /app/public/wp-content/plugins/blocks-ultimate/jsforwp-blocks.php on line 137

    Also for others who may try to rebrand the plugin, remember two things.

    * Do not use Upercase in your string as Block names may not contain uppercase.
    * Do not use “-“ as there are functions also which will break

    Now just need to fix that above error as well 🙂

    #38044
    Zac Gordon
    Keymaster

    What is on line 137 of blocks-ultimate/jsforwp-blocks.php?

    Had a feeling that it could be dynamic field related if anything, wasn’t sure what kind of block you were building. Should have asked ;p

    
    Also for others who may try to rebrand the plugin, remember two things.
    * Do not use Upercase in your string as Block names may not contain uppercase.
    * Do not use “-“ as there are functions also which will break
    

    ALSO, good tips for others!

    #38116
    munirkamal
    Participant

    Hey Zac,

    Yes that code is indeed related to Dynamic block and Dynamic Alt block. So why is it break after changing the brand string only? Any Idea? And well I am trying to build a multi block plugin. I will share with you as soon I got something ready. Still gettingggg staaarteed 🙁

    Thanks for you help.

    #40126
    mikemcalister
    Participant

    Hey there, there is a fix for this register_block_type error in another thread: https://javascriptforwp.com/forums/topic/moved-fatal-error-due-to-the-register_block_type/

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.