{"id":1439,"date":"2025-01-04T13:24:33","date_gmt":"2025-01-04T13:24:33","guid":{"rendered":"https:\/\/www.cmsgalaxy.com\/blog\/?p=1439"},"modified":"2025-01-04T13:24:35","modified_gmt":"2025-01-04T13:24:35","slug":"html-code-for-wordpress-block-editor-gutenberg-for-api-work-laravel-wordpress-rest-api-client","status":"publish","type":"post","link":"https:\/\/www.cmsgalaxy.com\/blog\/html-code-for-wordpress-block-editor-gutenberg-for-api-work-laravel-wordpress-rest-api-client\/","title":{"rendered":"HTML code for WordPress Block Editor (Gutenberg) for API work laravel-wordpress-rest-api-client"},"content":{"rendered":"\n<p>Here\u2019s a comprehensive list of commonly supported block names in the <strong>WordPress Block Editor (Gutenberg)<\/strong>. Each block name is explained, along with its attributes and example code for usage in the <strong>Gutenberg Block Format<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Table of Supported Block Names<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Block Name<\/th><th>Description<\/th><th>Common Attributes<\/th><th>Example Use Case<\/th><\/tr><\/thead><tbody><tr><td><code>core\/paragraph<\/code><\/td><td>Adds a text paragraph. Supports basic formatting like bold, italic, and links.<\/td><td><code>align<\/code>, <code>placeholder<\/code><\/td><td>Text content with inline formatting.<\/td><\/tr><tr><td><code>core\/heading<\/code><\/td><td>Adds a heading block (H1-H6).<\/td><td><code>level<\/code>, <code>align<\/code>, <code>placeholder<\/code><\/td><td>Section headings.<\/td><\/tr><tr><td><code>core\/list<\/code><\/td><td>Creates ordered or unordered lists.<\/td><td><code>ordered<\/code>, <code>align<\/code><\/td><td>Bullet or numbered lists.<\/td><\/tr><tr><td><code>core\/image<\/code><\/td><td>Embeds an image with captions and alt text.<\/td><td><code>url<\/code>, <code>align<\/code>, <code>alt<\/code>, <code>id<\/code><\/td><td>Adding visual content.<\/td><\/tr><tr><td><code>core\/quote<\/code><\/td><td>Adds a styled quote.<\/td><td><code>value<\/code>, <code>citation<\/code>, <code>align<\/code><\/td><td>Highlighting key quotes.<\/td><\/tr><tr><td><code>core\/gallery<\/code><\/td><td>Displays a grid of images.<\/td><td><code>ids<\/code>, <code>columns<\/code>, <code>align<\/code><\/td><td>Showcasing photo collections.<\/td><\/tr><tr><td><code>core\/video<\/code><\/td><td>Embeds a video file.<\/td><td><code>src<\/code>, <code>poster<\/code>, <code>align<\/code><\/td><td>Adding self-hosted videos.<\/td><\/tr><tr><td><code>core\/audio<\/code><\/td><td>Embeds an audio file.<\/td><td><code>src<\/code>, <code>align<\/code>, <code>autoplay<\/code><\/td><td>Playing audio clips.<\/td><\/tr><tr><td><code>core\/code<\/code><\/td><td>Displays preformatted code snippets.<\/td><td><code>content<\/code>, <code>align<\/code><\/td><td>Sharing code.<\/td><\/tr><tr><td><code>core\/html<\/code><\/td><td>Adds custom HTML content.<\/td><td>None<\/td><td>Custom HTML structures.<\/td><\/tr><tr><td><code>core\/embed<\/code><\/td><td>Embeds external content like YouTube, Twitter.<\/td><td><code>url<\/code>, <code>type<\/code>, <code>align<\/code><\/td><td>Embedding social media or videos.<\/td><\/tr><tr><td><code>core\/table<\/code><\/td><td>Creates a table with rows and columns.<\/td><td><code>align<\/code>, <code>hasFixedLayout<\/code><\/td><td>Organizing tabular data.<\/td><\/tr><tr><td><code>core\/button<\/code><\/td><td>Adds a styled button with a link.<\/td><td><code>text<\/code>, <code>url<\/code>, <code>align<\/code><\/td><td>Call-to-action buttons.<\/td><\/tr><tr><td><code>core\/separator<\/code><\/td><td>Adds a horizontal divider.<\/td><td><code>align<\/code>, <code>className<\/code><\/td><td>Dividing sections.<\/td><\/tr><tr><td><code>core\/spacer<\/code><\/td><td>Adds adjustable vertical space.<\/td><td><code>height<\/code><\/td><td>Adding spacing.<\/td><\/tr><tr><td><code>core\/columns<\/code><\/td><td>Creates a column layout.<\/td><td><code>columns<\/code>, <code>align<\/code><\/td><td>Structuring content into columns.<\/td><\/tr><tr><td><code>core\/group<\/code><\/td><td>Groups multiple blocks together.<\/td><td><code>align<\/code>, <code>className<\/code><\/td><td>Grouping blocks for styling.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Examples for Each Block<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. <strong>Paragraph (<code>core\/paragraph<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/paragraph\",\n    \"attrs\" =&gt; &#91;],\n    \"innerHTML\" =&gt; \"&lt;p&gt;This is a sample paragraph with &lt;strong&gt;bold&lt;\/strong&gt; and &lt;em&gt;italic&lt;\/em&gt; text.&lt;\/p&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;p&gt;This is a sample paragraph with &lt;strong&gt;bold&lt;\/strong&gt; and &lt;em&gt;italic&lt;\/em&gt; text.&lt;\/p&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2. <strong>Heading (<code>core\/heading<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/heading\",\n    \"attrs\" =&gt; &#91;\"level\" =&gt; 2],\n    \"innerHTML\" =&gt; \"&lt;h2&gt;Sample Heading&lt;\/h2&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;h2&gt;Sample Heading&lt;\/h2&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3. <strong>List (<code>core\/list<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/list\",\n    \"attrs\" =&gt; &#91;\"ordered\" =&gt; false],\n    \"innerHTML\" =&gt; \"&lt;ul&gt;&lt;li&gt;Item 1&lt;\/li&gt;&lt;li&gt;Item 2&lt;\/li&gt;&lt;\/ul&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;ul&gt;&lt;li&gt;Item 1&lt;\/li&gt;&lt;li&gt;Item 2&lt;\/li&gt;&lt;\/ul&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4. <strong>Image (<code>core\/image<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/image\",\n    \"attrs\" =&gt; &#91;\"url\" =&gt; \"https:\/\/example.com\/image.jpg\", \"alt\" =&gt; \"Sample Image\"],\n    \"innerHTML\" =&gt; \"&lt;figure&gt;&lt;img src='https:\/\/example.com\/image.jpg' alt='Sample Image'\/&gt;&lt;\/figure&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;figure&gt;&lt;img src='https:\/\/example.com\/image.jpg' alt='Sample Image'\/&gt;&lt;\/figure&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5. <strong>Quote (<code>core\/quote<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/quote\",\n    \"attrs\" =&gt; &#91;],\n    \"innerHTML\" =&gt; \"&lt;blockquote&gt;&lt;p&gt;Inspirational quote goes here.&lt;\/p&gt;&lt;cite&gt;Author Name&lt;\/cite&gt;&lt;\/blockquote&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;blockquote&gt;&lt;p&gt;Inspirational quote goes here.&lt;\/p&gt;&lt;cite&gt;Author Name&lt;\/cite&gt;&lt;\/blockquote&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">6. <strong>Gallery (<code>core\/gallery<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/gallery\",\n    \"attrs\" =&gt; &#91;\"ids\" =&gt; &#91;1, 2, 3], \"columns\" =&gt; 3],\n    \"innerHTML\" =&gt; \"&lt;figure class='wp-block-gallery columns-3'&gt;...&lt;\/figure&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;figure class='wp-block-gallery columns-3'&gt;...&lt;\/figure&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">7. <strong>Button (<code>core\/button<\/code>)<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n    \"blockName\" =&gt; \"core\/button\",\n    \"attrs\" =&gt; &#91;\"text\" =&gt; \"Click Me\", \"url\" =&gt; \"https:\/\/example.com\"],\n    \"innerHTML\" =&gt; \"&lt;a href='https:\/\/example.com' class='wp-block-button__link'&gt;Click Me&lt;\/a&gt;\",\n    \"innerBlocks\" =&gt; &#91;],\n    \"innerContent\" =&gt; &#91;\n        \"&lt;a href='https:\/\/example.com' class='wp-block-button__link'&gt;Click Me&lt;\/a&gt;\"\n    ]\n]\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to Use This in Laravel<\/strong><\/h3>\n\n\n\n<p>You can structure the content as a JSON-encoded array and pass it to the WordPress REST API when creating or updating posts. Here&#8217;s an example of how to send multiple blocks:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$content = &#91;\n    &#91;\n        \"blockName\" =&gt; \"core\/paragraph\",\n        \"attrs\" =&gt; &#91;],\n        \"innerHTML\" =&gt; \"&lt;p&gt;This is a paragraph block.&lt;\/p&gt;\",\n        \"innerBlocks\" =&gt; &#91;],\n        \"innerContent\" =&gt; &#91;\n            \"&lt;p&gt;This is a paragraph block.&lt;\/p&gt;\"\n        ]\n    ],\n    &#91;\n        \"blockName\" =&gt; \"core\/heading\",\n        \"attrs\" =&gt; &#91;\"level\" =&gt; 2],\n        \"innerHTML\" =&gt; \"&lt;h2&gt;Heading Block&lt;\/h2&gt;\",\n        \"innerBlocks\" =&gt; &#91;],\n        \"innerContent\" =&gt; &#91;\n            \"&lt;h2&gt;Heading Block&lt;\/h2&gt;\"\n        ]\n    ]\n];\n\n\/\/ Pass $content as JSON to the API.\n$data = &#91;\n    'title' =&gt; 'Post with Blocks',\n    'content' =&gt; json_encode($content),\n    'status' =&gt; 'publish'\n];\n<\/code><\/pre>\n\n\n\n<p>Let me know if you&#8217;d like additional examples or a deeper explanation of any specific block!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a comprehensive list of commonly supported block names in the WordPress Block Editor (Gutenberg). Each block name is explained,<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1439","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/1439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/comments?post=1439"}],"version-history":[{"count":1,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/1439\/revisions"}],"predecessor-version":[{"id":1440,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/1439\/revisions\/1440"}],"wp:attachment":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/media?parent=1439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/categories?post=1439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/tags?post=1439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}