![]() Some reasons for this are to help give users visual cues for what they can edit or there may be controls in the editor that need styling and do no appear on the frontend. There are some instances where you need to style blocks in the editor different from the frontend. To accomplish this, we enqueue our main block styles using enqueue_block_assets. The general principal for styling blocks in the new WordPress editor is to make them look the same in the editor as they do on the frontend. In this case, you would break out that functionality from your main block JavaScript and load it separately using enqueue_block_assets. ![]() ![]() For example, if you were building a slideshow or a form or some other element that needed frontend interaction. On occasion your block may require JavaScript to run properly on the frontend. Once a block is saved as content, the editor JavaScript is no longer needed, so most JavaScript for building blocks only needs to execute in the editor. In general, you will want to load your main block JavaScript using enqueue_block_editor_assets since your main block JavaScript code needs to execute inside the editor. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |