Using a Gallery block inside the editor

Once the Gallery block has been added, the editor will show the toolbar for the gallery with alignment options, as well as the two buttons for uploading images. This uploading form is generated within the code for the Gallery block inside WordPress. Once the images have been uploaded, the block will convert them into HTML tags and add them to the editor. These tags are only visible in the Code Editor while blocks are being displayed in the visual editor. The code for Gallery block will be similar to the following:

<!-- wp:gallery {"ids":[135]} -->
<ul class="wp-block-gallery columns-3 is-cropped"><li class="blocks-gallery-item"><figure><img src="http://localhost/cookbook1/wp-content/uploads/2019/09/69314037_44646_n.jpg" alt="" data-id="135" data-link="http://localhost/cookbook1/?attachment_id=135" class="wp-image-135"/></figure></li></ul>
<!-- /wp:gallery -->

As you can see, the block tag changes for the gallery to <!-- wp:gallery {"ids":[135]} -->. Apart from that, the content is pure HTML that's used to display the images within an <ul> element.

Once we use add/remove options, the editor will add or remove the block tag and the content inside it. We can use the same process to add/remove other blocks. The code and block tag that's used for each block will vary in the code editor. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset