<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>block editor Archives - Developry Plugins</title>
	<atom:link href="https://developryplugins.com/tag/block-editor/feed/" rel="self" type="application/rss+xml" />
	<link>https://developryplugins.com/tag/block-editor/</link>
	<description></description>
	<lastBuildDate>Mon, 24 Nov 2025 11:18:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://developryplugins.com/wp-content/uploads/2025/11/cropped-favicon-32x32.png</url>
	<title>block editor Archives - Developry Plugins</title>
	<link>https://developryplugins.com/tag/block-editor/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>WordPress Block Editor Keyboard Shortcuts: Complete Productivity Guide</title>
		<link>https://developryplugins.com/wordpress-block-editor-keyboard-shortcuts-complete-productivity-guide/</link>
		
		<dc:creator><![CDATA[Krasen Slavov]]></dc:creator>
		<pubDate>Mon, 30 Mar 2026 09:00:00 +0000</pubDate>
				<category><![CDATA[Block Editor & Gutenberg Tutorials]]></category>
		<category><![CDATA[block editor]]></category>
		<category><![CDATA[gutenberg shortcuts]]></category>
		<category><![CDATA[keyboard shortcuts]]></category>
		<category><![CDATA[productivity tips]]></category>
		<category><![CDATA[workflow optimization]]></category>
		<guid isPermaLink="false">https://developryplugins.com/?p=158</guid>

					<description><![CDATA[<p>Keyboard shortcuts transform the WordPress block editor from a point-and-click interface into a productivity powerhouse. Mastering these shortcuts can reduce content creation time by 50% or more, allowing you to...</p>
<p>The post <a href="https://developryplugins.com/wordpress-block-editor-keyboard-shortcuts-complete-productivity-guide/">WordPress Block Editor Keyboard Shortcuts: Complete Productivity Guide</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><!-- @format --></p>
<p>Keyboard shortcuts transform the WordPress block editor from a point-and-click interface into a productivity powerhouse. Mastering these shortcuts can reduce content creation time by 50% or more, allowing you to write, format, and publish faster than ever before.</p>
<h2 id="why-keyboard-shortcuts-matter">Why Keyboard Shortcuts Matter</h2>
<p>Content creators who master keyboard shortcuts report dramatic productivity improvements. Instead of constantly moving your hand between keyboard and mouse, shortcuts keep your hands in typing position, maintaining flow state and reducing physical strain.</p>
<p>Professional writers and editors can create content up to twice as fast using shortcuts. The time savings compound across hundreds of posts, translating to significant productivity gains.</p>
<h2 id="accessing-the-shortcuts-help-menu">Accessing the Shortcuts Help Menu</h2>
<p>Before memorizing shortcuts, learn the most important one: <strong>Shift+Alt+H</strong> (Windows) or <strong>Shift+Control+H</strong> (Mac). This opens the keyboard shortcuts help panel, providing instant reference for all available shortcuts.</p>
<p>The help panel organizes shortcuts by category: Global, Selection, Block, Text formatting, and more. Keep this panel open while learning shortcuts, then gradually rely on muscle memory.</p>
<h2 id="essential-navigation-shortcuts">Essential Navigation Shortcuts</h2>
<p>Navigation shortcuts move your cursor and selection efficiently without reaching for the mouse.</p>
<p><strong>Tab</strong> moves focus to the next block toolbar or interface element. <strong>Shift+Tab</strong> moves backward. These shortcuts allow you to navigate the entire editor using only the keyboard.</p>
<p><strong>Arrow keys</strong> move the text cursor within blocks. When no text is selected, <strong>Up Arrow</strong> and <strong>Down Arrow</strong> move between blocks.</p>
<p><strong>Escape</strong> clears selection and moves focus to the block toolbar. Press it again to deselect the block entirely. This shortcut is essential for keyboard-only navigation.</p>
<p><strong>Ctrl/Cmd+A</strong> selects all content in the current block. Press it twice to select all blocks in the editor.</p>
<h2 id="quick-block-insertion">Quick Block Insertion</h2>
<p>The forward slash <strong>(/)</strong> shortcut revolutionizes block insertion. Type <strong>/</strong> to open the block inserter menu, then start typing the block name. For example:</p>
<ul>
<li>Type <strong>/image</strong> to insert an image block</li>
<li>Type <strong>/heading</strong> for a heading block</li>
<li>Type <strong>/code</strong> for a code block</li>
<li>Type <strong>/quote</strong> for a quote block</li>
</ul>
<p>This autocomplete interface is faster than clicking the block inserter button and scrolling through options.</p>
<p><strong>Enter</strong> creates a new paragraph block below the current block. <strong>Shift+Enter</strong> inserts a line break within the same block without creating a new paragraph.</p>
<h2 id="text-formatting-shortcuts">Text Formatting Shortcuts</h2>
<p>Standard text formatting shortcuts work in the block editor:</p>
<ul>
<li><strong>Ctrl/Cmd+B</strong> &#8211; Bold text</li>
<li><strong>Ctrl/Cmd+I</strong> &#8211; Italic text</li>
<li><strong>Ctrl/Cmd+U</strong> &#8211; Underline text</li>
<li><strong>Ctrl/Cmd+K</strong> &#8211; Insert or edit link</li>
<li><strong>Ctrl/Cmd+Shift+X</strong> &#8211; Strikethrough text</li>
</ul>
<p>These shortcuts apply formatting to selected text or toggle formatting for new text you’re about to type.</p>
<h2 id="markdown-style-shortcuts">Markdown-Style Shortcuts</h2>
<p>The block editor supports markdown-style shortcuts for rapid formatting:</p>
<ul>
<li>Type <strong>##</strong> followed by space to create an H2 heading</li>
<li>Type <strong>###</strong> followed by space to create an H3 heading</li>
<li>Type <strong>*</strong> or <strong>&#8211;</strong> followed by space to create an unordered list</li>
<li>Type <strong>1.</strong> followed by space to create an ordered list</li>
<li>Type <strong>&gt;</strong> followed by space to create a quote block</li>
<li>Type <strong>&#8220;`</strong> followed by space to create a code block</li>
</ul>
<p>These shortcuts convert the current paragraph into the specified block type, streamlining content creation without interrupting your typing flow.</p>
<h2 id="block-manipulation-shortcuts">Block Manipulation Shortcuts</h2>
<p>Move and modify blocks without touching the mouse:</p>
<p><strong>Ctrl/Cmd+Shift+D</strong> duplicates the selected block(s). This is invaluable when creating similar content sections or testing layout variations.</p>
<p><strong>Ctrl/Cmd+Alt+T</strong> inserts a new block before the current block. <strong>Ctrl/Cmd+Alt+Y</strong> inserts a new block after. These shortcuts maintain your cursor position while adding blocks.</p>
<p><strong>Ctrl/Cmd+Shift+Z</strong> (Windows) or <strong>Ctrl+Alt+Backspace</strong> (Mac) removes the selected block.</p>
<h2 id="moving-blocks">Moving Blocks</h2>
<p>Rearrange content structure using movement shortcuts:</p>
<p><strong>Ctrl/Cmd+Shift+Up Arrow</strong> moves the current block up. <strong>Ctrl/Cmd+Shift+Down Arrow</strong> moves it down.</p>
<p>On Mac, you can also use <strong>Option+Control+Up/Down Arrow</strong> for block movement.</p>
<p>These shortcuts work with multi-block selections, allowing you to move entire sections at once.</p>
<h2 id="multi-block-selection">Multi-Block Selection</h2>
<p>Select multiple blocks for bulk operations:</p>
<p><strong>Shift+Click</strong> extends selection from the currently selected block to the clicked block, selecting all blocks in between.</p>
<p><strong>Ctrl/Cmd+Click</strong> toggles individual blocks in and out of selection, allowing non-contiguous selections.</p>
<p>Once multiple blocks are selected, use movement shortcuts to relocate entire sections or delete shortcuts to remove them all at once.</p>
<h2 id="editor-mode-switching">Editor Mode Switching</h2>
<p><strong>Ctrl/Cmd+Shift+Alt+M</strong> toggles between Edit and Select modes. Select mode allows you to select blocks by clicking anywhere on them, not just the toolbar, making it easier to select and move large blocks.</p>
<h2 id="saving-and-publishing">Saving and Publishing</h2>
<p><strong>Ctrl/Cmd+S</strong> saves your current changes as a draft. This works whether you’re editing a draft, published post, or page.</p>
<p>While there’s no default publishing shortcut, you can navigate to the Publish button using <strong>Tab</strong> and press <strong>Enter</strong> to publish.</p>
<h2 id="undo-and-redo">Undo and Redo</h2>
<p><strong>Ctrl/Cmd+Z</strong> undoes your last action. <strong>Ctrl/Cmd+Shift+Z</strong> (Windows) or <strong>Cmd+Shift+Z</strong> (Mac) redoes.</p>
<p>The block editor maintains a comprehensive undo history, tracking not just text changes but block additions, movements, and deletions.</p>
<h2 id="creating-a-workflow">Creating a Workflow</h2>
<p>Combine shortcuts into efficient workflows. Here’s a typical blog post creation workflow using only keyboard shortcuts:</p>
<ol type="1">
<li>Press <strong>/heading</strong> to create a title</li>
<li>Press <strong>Down Arrow</strong> then <strong>Enter</strong> to create a paragraph</li>
<li>Type content, using <strong>Ctrl/Cmd+B</strong> and <strong>Ctrl/Cmd+I</strong> for formatting</li>
<li>Press <strong>Enter</strong> to create new paragraphs</li>
<li>Type <strong>/image</strong> to insert images</li>
<li>Use <strong>Ctrl/Cmd+Shift+D</strong> to duplicate similar sections</li>
<li>Press <strong>Ctrl/Cmd+S</strong> frequently to save</li>
<li>Use <strong>Tab</strong> to navigate to Publish, press <strong>Enter</strong> to publish</li>
</ol>
<h2 id="shortcuts-cheat-sheet">Shortcuts Cheat Sheet</h2>
<p>Print or bookmark this quick reference:</p>
<p><strong>Navigation:</strong></p>
<ul>
<li>Tab/Shift+Tab &#8211; Navigate interface</li>
<li>Escape &#8211; Clear selection</li>
<li>Ctrl/Cmd+A &#8211; Select all</li>
</ul>
<p><strong>Insertion:</strong></p>
<ul>
<li>/ &#8211; Block inserter</li>
<li>Enter &#8211; New paragraph</li>
<li>Shift+Enter &#8211; Line break</li>
</ul>
<p><strong>Formatting:</strong></p>
<ul>
<li>Ctrl/Cmd+B &#8211; Bold</li>
<li>Ctrl/Cmd+I &#8211; Italic</li>
<li>Ctrl/Cmd+K &#8211; Link</li>
</ul>
<p><strong>Blocks:</strong></p>
<ul>
<li>Ctrl/Cmd+Shift+D &#8211; Duplicate</li>
<li>Ctrl/Cmd+Shift+Up/Down &#8211; Move</li>
<li>Ctrl/Cmd+Alt+T/Y &#8211; Insert before/after</li>
</ul>
<p><strong>Editor:</strong></p>
<ul>
<li>Ctrl/Cmd+S &#8211; Save</li>
<li>Ctrl/Cmd+Z &#8211; Undo</li>
<li>Shift+Alt+H &#8211; Help</li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>Keyboard shortcuts transform your block editor experience from slow and mouse-dependent to fast and efficient. Start by learning the most frequently used shortcuts—block insertion, formatting, and navigation. Gradually expand your repertoire, and you’ll soon find yourself creating content significantly faster than before.</p>
<h2 id="external-links">External Links</h2>
<ol type="1">
<li><a href="https://wordpress.org/support/article/keyboard-shortcuts/">WordPress Keyboard Shortcuts</a></li>
<li><a href="https://developer.wordpress.org/block-editor/">Block Editor Handbook</a></li>
<li><a href="https://www.wpbeginner.com/beginners-guide/wordpress-keyboard-shortcuts/">Gutenberg Keyboard Shortcuts Guide</a></li>
<li><a href="https://make.wordpress.org/accessibility/">Accessibility and Keyboard Navigation</a></li>
<li><a href="https://wordpress.org/support/article/wordpress-editor/">Block Editor Features</a></li>
</ol>
<h2 id="call-to-action">Call to Action</h2>
<p>Streamline your workflow! <a href="https://blocknavigatorplugin.com/#pricing">Block Editor Navigator Pro</a> provides instant block navigation, search, and organization. Find any block in seconds—try it free!</p>
<p>The post <a href="https://developryplugins.com/wordpress-block-editor-keyboard-shortcuts-complete-productivity-guide/">WordPress Block Editor Keyboard Shortcuts: Complete Productivity Guide</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>ACF and Gutenberg: Integrating Custom Fields with Block Editor</title>
		<link>https://developryplugins.com/acf-and-gutenberg-integrating-custom-fields-with-block-editor/</link>
		
		<dc:creator><![CDATA[Krasen Slavov]]></dc:creator>
		<pubDate>Fri, 10 Oct 2025 09:00:00 +0000</pubDate>
				<category><![CDATA[Advanced Custom Fields (ACF) Tutorials]]></category>
		<category><![CDATA[acf blocks]]></category>
		<category><![CDATA[acf pro]]></category>
		<category><![CDATA[block editor]]></category>
		<category><![CDATA[custom blocks]]></category>
		<category><![CDATA[gutenberg]]></category>
		<guid isPermaLink="false">https://developryplugins.com/acf-and-gutenberg-integrating-custom-fields-with-block-editor/</guid>

					<description><![CDATA[<p>ACF Blocks (ACF PRO) enable custom Gutenberg block creation through PHP registration combining block editor flexibility with ACF field power. From simple content blocks with custom fields to complex layouts...</p>
<p>The post <a href="https://developryplugins.com/acf-and-gutenberg-integrating-custom-fields-with-block-editor/">ACF and Gutenberg: Integrating Custom Fields with Block Editor</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><!-- @format --></p>
<p>ACF Blocks (ACF PRO) enable custom Gutenberg block creation through PHP registration combining block editor flexibility with ACF field power. From simple content blocks with custom fields to complex layouts with InnerBlocks and block templates, ACF Blocks eliminate React JavaScript requirements. This comprehensive guide teaches ACF Block registration, field integration, render callbacks, block templates, InnerBlocks support, and advanced techniques creating custom WordPress Gutenberg blocks with familiar ACF workflows.</p>
<h2 id="what-are-acf-blocks">What Are ACF Blocks?</h2>
<p><strong>ACF Blocks Concept</strong> (ACF PRO 5.8+):</p>
<p>ACF Blocks create custom Gutenberg blocks using PHP:</p>
<ul>
<li><strong>No React required</strong>: Use PHP templates</li>
<li><strong>ACF Fields</strong>: Familiar field interface</li>
<li><strong>Block Controls</strong>: Native block toolbar</li>
<li><strong>Reusable</strong>: Save and reuse block instances</li>
<li><strong>Flexible</strong>: Full block editor integration</li>
</ul>
<p><strong>Block vs Field Group</strong>:</p>
<pre><code>Traditional Field Group:
- Attached to post type
- Single metabox location
- Fixed field order

ACF Block:
- Insertable anywhere in content
- Multiple instances per post
- Drag-and-drop positioning
- Reusable patterns</code></pre>
<h2 id="basic-block-registration">Basic Block Registration</h2>
<p><strong>Register Simple Block</strong> (functions.php):</p>
<div class="sourceCode" id="cb2">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true"></a><span class="kw">function</span> mytheme_register_acf_blocks<span class="ot">()</span> {</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true"></a>    <span class="co">// Check ACF function exists</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true"></a>    <span class="kw">if</span> <span class="ot">(</span><span class="fu">function_exists</span><span class="ot">(</span><span class="st">&#39;acf_register_block_type&#39;</span><span class="ot">))</span> {</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true"></a>        acf_register_block_type<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true"></a>            <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;testimonial&#39;</span><span class="ot">,</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true"></a>            <span class="st">&#39;title&#39;</span> =&gt; <span class="kw">__</span><span class="ot">(</span><span class="st">&#39;Testimonial&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true"></a>            <span class="st">&#39;description&#39;</span> =&gt; <span class="kw">__</span><span class="ot">(</span><span class="st">&#39;A custom testimonial block&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true"></a>            <span class="st">&#39;render_template&#39;</span> =&gt; get_template_directory<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.php&#39;</span><span class="ot">,</span></span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true"></a>            <span class="st">&#39;category&#39;</span> =&gt; <span class="st">&#39;common&#39;</span><span class="ot">,</span></span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true"></a>            <span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;format-quote&#39;</span><span class="ot">,</span></span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true"></a>            <span class="st">&#39;keywords&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;testimonial&#39;</span><span class="ot">,</span> <span class="st">&#39;quote&#39;</span><span class="ot">,</span> <span class="st">&#39;review&#39;</span><span class="ot">),</span></span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true"></a>        <span class="ot">));</span></span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true"></a>    }</span>
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true"></a>}</span>
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;acf/init&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_register_acf_blocks&#39;</span><span class="ot">);</span></span></code></pre>
</div>
<h2 id="block-registration-parameters">Block Registration Parameters</h2>
<p><strong>Complete Configuration</strong>:</p>
<div class="sourceCode" id="cb3">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true"></a>acf_register_block_type<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true"></a>    <span class="co">// Required</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true"></a>    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;testimonial&#39;</span><span class="ot">,</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true"></a>    <span class="st">&#39;title&#39;</span> =&gt; <span class="kw">__</span><span class="ot">(</span><span class="st">&#39;Testimonial&#39;</span><span class="ot">),</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true"></a></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true"></a>    <span class="co">// Content</span></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true"></a>    <span class="st">&#39;description&#39;</span> =&gt; <span class="kw">__</span><span class="ot">(</span><span class="st">&#39;A testimonial block&#39;</span><span class="ot">),</span></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true"></a>    <span class="st">&#39;render_template&#39;</span> =&gt; <span class="st">&#39;blocks/testimonial.php&#39;</span><span class="ot">,</span></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true"></a>    <span class="st">&#39;render_callback&#39;</span> =&gt; <span class="st">&#39;mytheme_render_testimonial&#39;</span><span class="ot">,</span></span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true"></a></span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true"></a>    <span class="co">// Appearance</span></span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true"></a>    <span class="st">&#39;category&#39;</span> =&gt; <span class="st">&#39;common&#39;</span><span class="ot">,</span></span>
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true"></a>    <span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;format-quote&#39;</span><span class="ot">,</span></span>
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true"></a>    <span class="st">&#39;keywords&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;testimonial&#39;</span><span class="ot">),</span></span>
<span id="cb3-15"><a href="#cb3-15" aria-hidden="true"></a></span>
<span id="cb3-16"><a href="#cb3-16" aria-hidden="true"></a>    <span class="co">// Behavior</span></span>
<span id="cb3-17"><a href="#cb3-17" aria-hidden="true"></a>    <span class="st">&#39;mode&#39;</span> =&gt; <span class="st">&#39;preview&#39;</span><span class="ot">,</span></span>
<span id="cb3-18"><a href="#cb3-18" aria-hidden="true"></a>    <span class="st">&#39;align&#39;</span> =&gt; <span class="st">&#39;full&#39;</span><span class="ot">,</span></span>
<span id="cb3-19"><a href="#cb3-19" aria-hidden="true"></a>    <span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb3-20"><a href="#cb3-20" aria-hidden="true"></a>        <span class="st">&#39;align&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span></span>
<span id="cb3-21"><a href="#cb3-21" aria-hidden="true"></a>        <span class="st">&#39;mode&#39;</span> =&gt; <span class="kw">false</span><span class="ot">,</span></span>
<span id="cb3-22"><a href="#cb3-22" aria-hidden="true"></a>        <span class="st">&#39;multiple&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span></span>
<span id="cb3-23"><a href="#cb3-23" aria-hidden="true"></a>        <span class="st">&#39;jsx&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span></span>
<span id="cb3-24"><a href="#cb3-24" aria-hidden="true"></a>    <span class="ot">),</span></span>
<span id="cb3-25"><a href="#cb3-25" aria-hidden="true"></a></span>
<span id="cb3-26"><a href="#cb3-26" aria-hidden="true"></a>    <span class="co">// Style</span></span>
<span id="cb3-27"><a href="#cb3-27" aria-hidden="true"></a>    <span class="st">&#39;enqueue_style&#39;</span> =&gt; get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.css&#39;</span><span class="ot">,</span></span>
<span id="cb3-28"><a href="#cb3-28" aria-hidden="true"></a>    <span class="st">&#39;enqueue_script&#39;</span> =&gt; get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.js&#39;</span><span class="ot">,</span></span>
<span id="cb3-29"><a href="#cb3-29" aria-hidden="true"></a>    <span class="st">&#39;enqueue_assets&#39;</span> =&gt; <span class="st">&#39;mytheme_testimonial_assets&#39;</span><span class="ot">,</span></span>
<span id="cb3-30"><a href="#cb3-30" aria-hidden="true"></a></span>
<span id="cb3-31"><a href="#cb3-31" aria-hidden="true"></a>    <span class="co">// Advanced</span></span>
<span id="cb3-32"><a href="#cb3-32" aria-hidden="true"></a>    <span class="st">&#39;post_types&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;post&#39;</span><span class="ot">,</span> <span class="st">&#39;page&#39;</span><span class="ot">),</span></span>
<span id="cb3-33"><a href="#cb3-33" aria-hidden="true"></a>    <span class="st">&#39;example&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb3-34"><a href="#cb3-34" aria-hidden="true"></a>        <span class="st">&#39;attributes&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb3-35"><a href="#cb3-35" aria-hidden="true"></a>            <span class="st">&#39;mode&#39;</span> =&gt; <span class="st">&#39;preview&#39;</span><span class="ot">,</span></span>
<span id="cb3-36"><a href="#cb3-36" aria-hidden="true"></a>            <span class="st">&#39;data&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb3-37"><a href="#cb3-37" aria-hidden="true"></a>                <span class="st">&#39;author&#39;</span> =&gt; <span class="st">&#39;John Doe&#39;</span><span class="ot">,</span></span>
<span id="cb3-38"><a href="#cb3-38" aria-hidden="true"></a>                <span class="st">&#39;quote&#39;</span> =&gt; <span class="st">&#39;Amazing service!&#39;</span><span class="ot">,</span></span>
<span id="cb3-39"><a href="#cb3-39" aria-hidden="true"></a>            <span class="ot">),</span></span>
<span id="cb3-40"><a href="#cb3-40" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb3-41"><a href="#cb3-41" aria-hidden="true"></a>    <span class="ot">),</span></span>
<span id="cb3-42"><a href="#cb3-42" aria-hidden="true"></a><span class="ot">));</span></span></code></pre>
</div>
<p><strong>Parameter Explanations</strong>:</p>
<pre><code>name: Unique slug (no spaces)
title: Display name in inserter
description: Block description
render_template: PHP file path
render_callback: PHP function name
category: Block category
icon: Dashicon or custom SVG
keywords: Search terms
mode: &#39;preview&#39;, &#39;edit&#39;, or &#39;auto&#39;
align: Default alignment
supports: Block capabilities
enqueue_style: CSS file URL
enqueue_script: JS file URL
post_types: Allowed post types
example: Preview data</code></pre>
<h2 id="creating-block-template">Creating Block Template</h2>
<p><strong>Testimonial Block Template</strong> (blocks/testimonial.php):</p>
<div class="sourceCode" id="cb5">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true"></a><span class="kw">&lt;?php</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true"></a><span class="co"> * Testimonial Block Template</span></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true"></a><span class="co"> *</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true"></a><span class="co"> * </span><span class="an">@param</span><span class="co"> </span><span class="cv">array</span><span class="co"> $block The block settings and attributes</span></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true"></a><span class="co"> * </span><span class="an">@param</span><span class="co"> </span><span class="cv">string</span><span class="co"> $content The block inner HTML (empty)</span></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true"></a><span class="co"> * </span><span class="an">@param</span><span class="co"> </span><span class="cv">bool</span><span class="co"> $is_preview True during AJAX preview</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true"></a><span class="co"> * </span><span class="an">@param</span><span class="co"> </span><span class="cv">int</span><span class="co"> $post_id The post ID this block is saved to</span></span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true"></a></span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true"></a><span class="co">// Get ACF fields</span></span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true"></a><span class="kw">$author</span> = get_field<span class="ot">(</span><span class="st">&#39;author&#39;</span><span class="ot">);</span></span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true"></a><span class="kw">$company</span> = get_field<span class="ot">(</span><span class="st">&#39;company&#39;</span><span class="ot">);</span></span>
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true"></a><span class="kw">$quote</span> = get_field<span class="ot">(</span><span class="st">&#39;quote&#39;</span><span class="ot">);</span></span>
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true"></a><span class="kw">$photo</span> = get_field<span class="ot">(</span><span class="st">&#39;photo&#39;</span><span class="ot">);</span></span>
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true"></a><span class="kw">$rating</span> = get_field<span class="ot">(</span><span class="st">&#39;rating&#39;</span><span class="ot">);</span></span>
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true"></a></span>
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true"></a><span class="co">// Block ID</span></span>
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true"></a><span class="kw">$block_id</span> = <span class="st">&#39;testimonial-&#39;</span> . <span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;id&#39;</span><span class="ot">];</span></span>
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true"></a></span>
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true"></a><span class="co">// Block classes</span></span>
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true"></a><span class="kw">$class_name</span> = <span class="st">&#39;testimonial-block&#39;</span><span class="ot">;</span></span>
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true"></a><span class="kw">if</span> <span class="ot">(</span>!<span class="kw">empty</span><span class="ot">(</span><span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;className&#39;</span><span class="ot">]))</span> {</span>
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true"></a>    <span class="kw">$class_name</span> .= <span class="st">&#39; &#39;</span> . <span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;className&#39;</span><span class="ot">];</span></span>
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true"></a>}</span>
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true"></a><span class="kw">if</span> <span class="ot">(</span>!<span class="kw">empty</span><span class="ot">(</span><span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;align&#39;</span><span class="ot">]))</span> {</span>
<span id="cb5-27"><a href="#cb5-27" aria-hidden="true"></a>    <span class="kw">$class_name</span> .= <span class="st">&#39; align&#39;</span> . <span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;align&#39;</span><span class="ot">];</span></span>
<span id="cb5-28"><a href="#cb5-28" aria-hidden="true"></a>}</span>
<span id="cb5-29"><a href="#cb5-29" aria-hidden="true"></a><span class="kw">?&gt;</span></span>
<span id="cb5-30"><a href="#cb5-30" aria-hidden="true"></a></span>
<span id="cb5-31"><a href="#cb5-31" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;&lt;?php echo esc_attr(</span><span class="kw">$block_id</span><span class="st">); ?&gt;&quot;</span> <span class="kw">class</span>=<span class="st">&quot;&lt;?php echo esc_attr(</span><span class="kw">$class_name</span><span class="st">); ?&gt;&quot;</span>&gt;</span>
<span id="cb5-32"><a href="#cb5-32" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$quote</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb5-33"><a href="#cb5-33" aria-hidden="true"></a>        &lt;blockquote <span class="kw">class</span>=<span class="st">&quot;testimonial-quote&quot;</span>&gt;</span>
<span id="cb5-34"><a href="#cb5-34" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$quote</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb5-35"><a href="#cb5-35" aria-hidden="true"></a>        &lt;/blockquote&gt;</span>
<span id="cb5-36"><a href="#cb5-36" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb5-37"><a href="#cb5-37" aria-hidden="true"></a></span>
<span id="cb5-38"><a href="#cb5-38" aria-hidden="true"></a>    &lt;div <span class="kw">class</span>=<span class="st">&quot;testimonial-author&quot;</span>&gt;</span>
<span id="cb5-39"><a href="#cb5-39" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$photo</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb5-40"><a href="#cb5-40" aria-hidden="true"></a>            &lt;img src=<span class="st">&quot;&lt;?php echo esc_url(</span><span class="kw">$photo</span><span class="st">[&#39;sizes&#39;][&#39;thumbnail&#39;]); ?&gt;&quot;</span></span>
<span id="cb5-41"><a href="#cb5-41" aria-hidden="true"></a>                 alt=<span class="st">&quot;&lt;?php echo esc_attr(</span><span class="kw">$author</span><span class="st">); ?&gt;&quot;</span></span>
<span id="cb5-42"><a href="#cb5-42" aria-hidden="true"></a>                 <span class="kw">class</span>=<span class="st">&quot;author-photo&quot;</span> /&gt;</span>
<span id="cb5-43"><a href="#cb5-43" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb5-44"><a href="#cb5-44" aria-hidden="true"></a></span>
<span id="cb5-45"><a href="#cb5-45" aria-hidden="true"></a>        &lt;div <span class="kw">class</span>=<span class="st">&quot;author-info&quot;</span>&gt;</span>
<span id="cb5-46"><a href="#cb5-46" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$author</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb5-47"><a href="#cb5-47" aria-hidden="true"></a>                &lt;strong <span class="kw">class</span>=<span class="st">&quot;author-name&quot;</span>&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$author</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/strong&gt;</span>
<span id="cb5-48"><a href="#cb5-48" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb5-49"><a href="#cb5-49" aria-hidden="true"></a></span>
<span id="cb5-50"><a href="#cb5-50" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$company</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb5-51"><a href="#cb5-51" aria-hidden="true"></a>                &lt;span <span class="kw">class</span>=<span class="st">&quot;author-company&quot;</span>&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$company</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/span&gt;</span>
<span id="cb5-52"><a href="#cb5-52" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb5-53"><a href="#cb5-53" aria-hidden="true"></a></span>
<span id="cb5-54"><a href="#cb5-54" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$rating</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb5-55"><a href="#cb5-55" aria-hidden="true"></a>                &lt;div <span class="kw">class</span>=<span class="st">&quot;rating&quot;</span>&gt;</span>
<span id="cb5-56"><a href="#cb5-56" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php <span class="kw">for</span> <span class="ot">(</span><span class="kw">$i</span> = <span class="dv">0</span><span class="ot">;</span> <span class="kw">$i</span> &lt; <span class="kw">$rating</span><span class="ot">;</span> <span class="kw">$i</span>++<span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb5-57"><a href="#cb5-57" aria-hidden="true"></a>                        &lt;span <span class="kw">class</span>=<span class="st">&quot;star&quot;</span>&gt;★&lt;/span&gt;</span>
<span id="cb5-58"><a href="#cb5-58" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php <span class="kw">endfor</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb5-59"><a href="#cb5-59" aria-hidden="true"></a>                &lt;/div&gt;</span>
<span id="cb5-60"><a href="#cb5-60" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb5-61"><a href="#cb5-61" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb5-62"><a href="#cb5-62" aria-hidden="true"></a>    &lt;/div&gt;</span>
<span id="cb5-63"><a href="#cb5-63" aria-hidden="true"></a>&lt;/div&gt;</span></code></pre>
</div>
<h2 id="block-field-group">Block Field Group</h2>
<p><strong>Register Fields for Block</strong>:</p>
<div class="sourceCode" id="cb6">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true"></a><span class="kw">function</span> mytheme_register_block_fields<span class="ot">()</span> {</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true"></a>    <span class="kw">if</span> <span class="ot">(</span><span class="fu">function_exists</span><span class="ot">(</span><span class="st">&#39;acf_add_local_field_group&#39;</span><span class="ot">))</span> {</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true"></a>        acf_add_local_field_group<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true"></a>            <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;group_testimonial_block&#39;</span><span class="ot">,</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true"></a>            <span class="st">&#39;title&#39;</span> =&gt; <span class="st">&#39;Testimonial Block Fields&#39;</span><span class="ot">,</span></span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true"></a>            <span class="st">&#39;fields&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true"></a>                <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true"></a>                    <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_author&#39;</span><span class="ot">,</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true"></a>                    <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Author&#39;</span><span class="ot">,</span></span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true"></a>                    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;author&#39;</span><span class="ot">,</span></span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true"></a>                    <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;text&#39;</span><span class="ot">,</span></span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true"></a>                    <span class="st">&#39;required&#39;</span> =&gt; <span class="dv">1</span><span class="ot">,</span></span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true"></a>                <span class="ot">),</span></span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true"></a>                <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true"></a>                    <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_company&#39;</span><span class="ot">,</span></span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true"></a>                    <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Company&#39;</span><span class="ot">,</span></span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true"></a>                    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;company&#39;</span><span class="ot">,</span></span>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true"></a>                    <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;text&#39;</span><span class="ot">,</span></span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true"></a>                <span class="ot">),</span></span>
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true"></a>                <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true"></a>                    <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_quote&#39;</span><span class="ot">,</span></span>
<span id="cb6-22"><a href="#cb6-22" aria-hidden="true"></a>                    <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Quote&#39;</span><span class="ot">,</span></span>
<span id="cb6-23"><a href="#cb6-23" aria-hidden="true"></a>                    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;quote&#39;</span><span class="ot">,</span></span>
<span id="cb6-24"><a href="#cb6-24" aria-hidden="true"></a>                    <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;textarea&#39;</span><span class="ot">,</span></span>
<span id="cb6-25"><a href="#cb6-25" aria-hidden="true"></a>                    <span class="st">&#39;required&#39;</span> =&gt; <span class="dv">1</span><span class="ot">,</span></span>
<span id="cb6-26"><a href="#cb6-26" aria-hidden="true"></a>                <span class="ot">),</span></span>
<span id="cb6-27"><a href="#cb6-27" aria-hidden="true"></a>                <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-28"><a href="#cb6-28" aria-hidden="true"></a>                    <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_photo&#39;</span><span class="ot">,</span></span>
<span id="cb6-29"><a href="#cb6-29" aria-hidden="true"></a>                    <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Photo&#39;</span><span class="ot">,</span></span>
<span id="cb6-30"><a href="#cb6-30" aria-hidden="true"></a>                    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;photo&#39;</span><span class="ot">,</span></span>
<span id="cb6-31"><a href="#cb6-31" aria-hidden="true"></a>                    <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;image&#39;</span><span class="ot">,</span></span>
<span id="cb6-32"><a href="#cb6-32" aria-hidden="true"></a>                    <span class="st">&#39;return_format&#39;</span> =&gt; <span class="st">&#39;array&#39;</span><span class="ot">,</span></span>
<span id="cb6-33"><a href="#cb6-33" aria-hidden="true"></a>                <span class="ot">),</span></span>
<span id="cb6-34"><a href="#cb6-34" aria-hidden="true"></a>                <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-35"><a href="#cb6-35" aria-hidden="true"></a>                    <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_rating&#39;</span><span class="ot">,</span></span>
<span id="cb6-36"><a href="#cb6-36" aria-hidden="true"></a>                    <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Rating&#39;</span><span class="ot">,</span></span>
<span id="cb6-37"><a href="#cb6-37" aria-hidden="true"></a>                    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;rating&#39;</span><span class="ot">,</span></span>
<span id="cb6-38"><a href="#cb6-38" aria-hidden="true"></a>                    <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;range&#39;</span><span class="ot">,</span></span>
<span id="cb6-39"><a href="#cb6-39" aria-hidden="true"></a>                    <span class="st">&#39;min&#39;</span> =&gt; <span class="dv">1</span><span class="ot">,</span></span>
<span id="cb6-40"><a href="#cb6-40" aria-hidden="true"></a>                    <span class="st">&#39;max&#39;</span> =&gt; <span class="dv">5</span><span class="ot">,</span></span>
<span id="cb6-41"><a href="#cb6-41" aria-hidden="true"></a>                    <span class="st">&#39;step&#39;</span> =&gt; <span class="dv">1</span><span class="ot">,</span></span>
<span id="cb6-42"><a href="#cb6-42" aria-hidden="true"></a>                    <span class="st">&#39;default_value&#39;</span> =&gt; <span class="dv">5</span><span class="ot">,</span></span>
<span id="cb6-43"><a href="#cb6-43" aria-hidden="true"></a>                <span class="ot">),</span></span>
<span id="cb6-44"><a href="#cb6-44" aria-hidden="true"></a>            <span class="ot">),</span></span>
<span id="cb6-45"><a href="#cb6-45" aria-hidden="true"></a>            <span class="st">&#39;location&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-46"><a href="#cb6-46" aria-hidden="true"></a>                <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-47"><a href="#cb6-47" aria-hidden="true"></a>                    <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb6-48"><a href="#cb6-48" aria-hidden="true"></a>                        <span class="st">&#39;param&#39;</span> =&gt; <span class="st">&#39;block&#39;</span><span class="ot">,</span></span>
<span id="cb6-49"><a href="#cb6-49" aria-hidden="true"></a>                        <span class="st">&#39;operator&#39;</span> =&gt; <span class="st">&#39;==&#39;</span><span class="ot">,</span></span>
<span id="cb6-50"><a href="#cb6-50" aria-hidden="true"></a>                        <span class="st">&#39;value&#39;</span> =&gt; <span class="st">&#39;acf/testimonial&#39;</span><span class="ot">,</span></span>
<span id="cb6-51"><a href="#cb6-51" aria-hidden="true"></a>                    <span class="ot">),</span></span>
<span id="cb6-52"><a href="#cb6-52" aria-hidden="true"></a>                <span class="ot">),</span></span>
<span id="cb6-53"><a href="#cb6-53" aria-hidden="true"></a>            <span class="ot">),</span></span>
<span id="cb6-54"><a href="#cb6-54" aria-hidden="true"></a>        <span class="ot">));</span></span>
<span id="cb6-55"><a href="#cb6-55" aria-hidden="true"></a>    }</span>
<span id="cb6-56"><a href="#cb6-56" aria-hidden="true"></a>}</span>
<span id="cb6-57"><a href="#cb6-57" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;acf/init&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_register_block_fields&#39;</span><span class="ot">);</span></span></code></pre>
</div>
<h2 id="block-categories">Block Categories</h2>
<p><strong>Built-in Categories</strong>:</p>
<pre><code>&#39;common&#39; - Common
&#39;formatting&#39; - Formatting
&#39;layout&#39; - Layout
&#39;widgets&#39; - Widgets
&#39;embed&#39; - Embeds</code></pre>
<p><strong>Custom Category</strong>:</p>
<div class="sourceCode" id="cb8">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true"></a><span class="kw">function</span> mytheme_block_categories<span class="ot">(</span><span class="kw">$categories</span><span class="ot">)</span> {</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true"></a>    <span class="kw">return</span> <span class="fu">array_merge</span><span class="ot">(</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true"></a>        <span class="kw">$categories</span><span class="ot">,</span></span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true"></a>            <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true"></a>                <span class="st">&#39;slug&#39;</span> =&gt; <span class="st">&#39;custom-blocks&#39;</span><span class="ot">,</span></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true"></a>                <span class="st">&#39;title&#39;</span> =&gt; <span class="kw">__</span><span class="ot">(</span><span class="st">&#39;Custom Blocks&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true"></a>                <span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;admin-customizer&#39;</span><span class="ot">,</span></span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true"></a>            <span class="ot">),</span></span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true"></a>        <span class="ot">)</span></span>
<span id="cb8-11"><a href="#cb8-11" aria-hidden="true"></a>    <span class="ot">);</span></span>
<span id="cb8-12"><a href="#cb8-12" aria-hidden="true"></a>}</span>
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true"></a>add_filter<span class="ot">(</span><span class="st">&#39;block_categories_all&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_block_categories&#39;</span><span class="ot">,</span> <span class="dv">10</span><span class="ot">,</span> <span class="dv">2</span><span class="ot">);</span></span></code></pre>
</div>
<h2 id="block-icons">Block Icons</h2>
<p><strong>Dashicon Icon</strong>:</p>
<div class="sourceCode" id="cb9">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true"></a><span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;format-quote&#39;</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true"></a><span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;admin-users&#39;</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true"></a><span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;heart&#39;</span></span></code></pre>
</div>
<p><strong>Custom SVG Icon</strong>:</p>
<div class="sourceCode" id="cb10">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true"></a><span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;path d=&quot;M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z&quot;/&gt;&lt;/svg&gt;&#39;</span></span></code></pre>
</div>
<p><strong>Icon with Background</strong>:</p>
<div class="sourceCode" id="cb11">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true"></a><span class="st">&#39;icon&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true"></a>    <span class="st">&#39;background&#39;</span> =&gt; <span class="st">&#39;#7e70af&#39;</span><span class="ot">,</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true"></a>    <span class="st">&#39;foreground&#39;</span> =&gt; <span class="st">&#39;#fff&#39;</span><span class="ot">,</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true"></a>    <span class="st">&#39;src&#39;</span> =&gt; <span class="st">&#39;format-quote&#39;</span><span class="ot">,</span></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true"></a><span class="ot">)</span></span></code></pre>
</div>
<h2 id="block-modes">Block Modes</h2>
<p><strong>Mode Options</strong>:</p>
<div class="sourceCode" id="cb12">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true"></a><span class="co">// Preview mode (default)</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true"></a><span class="st">&#39;mode&#39;</span> =&gt; <span class="st">&#39;preview&#39;</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true"></a></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true"></a><span class="co">// Edit mode (show fields)</span></span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true"></a><span class="st">&#39;mode&#39;</span> =&gt; <span class="st">&#39;edit&#39;</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true"></a></span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true"></a><span class="co">// Auto switch</span></span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true"></a><span class="st">&#39;mode&#39;</span> =&gt; <span class="st">&#39;auto&#39;</span></span></code></pre>
</div>
<p><strong>Allow Mode Switching</strong>:</p>
<div class="sourceCode" id="cb13">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true"></a><span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true"></a>    <span class="st">&#39;mode&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span> <span class="co">// Allow users to toggle</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true"></a><span class="ot">)</span></span></code></pre>
</div>
<h2 id="block-alignment">Block Alignment</h2>
<p><strong>Set Default Alignment</strong>:</p>
<div class="sourceCode" id="cb14">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true"></a><span class="st">&#39;align&#39;</span> =&gt; <span class="st">&#39;full&#39;</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true"></a><span class="st">&#39;align&#39;</span> =&gt; <span class="st">&#39;wide&#39;</span></span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true"></a><span class="st">&#39;align&#39;</span> =&gt; <span class="st">&#39;center&#39;</span></span></code></pre>
</div>
<p><strong>Enable Alignment Control</strong>:</p>
<div class="sourceCode" id="cb15">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true"></a><span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true"></a>    <span class="st">&#39;align&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span> <span class="co">// Enable alignment toolbar</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true"></a>    <span class="st">&#39;align&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;left&#39;</span><span class="ot">,</span> <span class="st">&#39;center&#39;</span><span class="ot">,</span> <span class="st">&#39;right&#39;</span><span class="ot">),</span> <span class="co">// Specific alignments</span></span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true"></a><span class="ot">)</span></span></code></pre>
</div>
<h2 id="innerblocks-support">InnerBlocks Support</h2>
<p><strong>Enable Nested Blocks</strong>:</p>
<div class="sourceCode" id="cb16">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true"></a><span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true"></a>    <span class="st">&#39;jsx&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span></span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true"></a><span class="ot">)</span></span></code></pre>
</div>
<p><strong>Template with InnerBlocks</strong>:</p>
<div class="sourceCode" id="cb17">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true"></a>&lt;div <span class="kw">class</span>=<span class="st">&quot;container-block&quot;</span>&gt;</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true"></a>    &lt;div <span class="kw">class</span>=<span class="st">&quot;container-header&quot;</span>&gt;</span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true"></a>        &lt;h2&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span>get_field<span class="ot">(</span><span class="st">&#39;title&#39;</span><span class="ot">));</span> <span class="kw">?&gt;</span>&lt;/h2&gt;</span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true"></a>    &lt;/div&gt;</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true"></a></span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true"></a>    &lt;div <span class="kw">class</span>=<span class="st">&quot;container-content&quot;</span>&gt;</span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true"></a>        &lt;InnerBlocks /&gt;</span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true"></a>    &lt;/div&gt;</span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true"></a>&lt;/div&gt;</span></code></pre>
</div>
<h2 id="block-example-preview">Block Example (Preview)</h2>
<p><strong>Provide Preview Data</strong>:</p>
<div class="sourceCode" id="cb18">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true"></a><span class="st">&#39;example&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true"></a>    <span class="st">&#39;attributes&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true"></a>        <span class="st">&#39;mode&#39;</span> =&gt; <span class="st">&#39;preview&#39;</span><span class="ot">,</span></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true"></a>        <span class="st">&#39;data&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true"></a>            <span class="st">&#39;author&#39;</span> =&gt; <span class="st">&#39;Jane Smith&#39;</span><span class="ot">,</span></span>
<span id="cb18-6"><a href="#cb18-6" aria-hidden="true"></a>            <span class="st">&#39;company&#39;</span> =&gt; <span class="st">&#39;Acme Corp&#39;</span><span class="ot">,</span></span>
<span id="cb18-7"><a href="#cb18-7" aria-hidden="true"></a>            <span class="st">&#39;quote&#39;</span> =&gt; <span class="st">&#39;This is an amazing product!&#39;</span><span class="ot">,</span></span>
<span id="cb18-8"><a href="#cb18-8" aria-hidden="true"></a>            <span class="st">&#39;rating&#39;</span> =&gt; <span class="st">&#39;5&#39;</span><span class="ot">,</span></span>
<span id="cb18-9"><a href="#cb18-9" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb18-10"><a href="#cb18-10" aria-hidden="true"></a>    <span class="ot">),</span></span>
<span id="cb18-11"><a href="#cb18-11" aria-hidden="true"></a><span class="ot">)</span></span></code></pre>
</div>
<h2 id="enqueue-block-assets">Enqueue Block Assets</h2>
<p><strong>Separate CSS/JS Files</strong>:</p>
<div class="sourceCode" id="cb19">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true"></a><span class="st">&#39;enqueue_style&#39;</span> =&gt; get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.css&#39;</span><span class="ot">,</span></span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true"></a><span class="st">&#39;enqueue_script&#39;</span> =&gt; get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.js&#39;</span><span class="ot">,</span></span></code></pre>
</div>
<p><strong>Asset Callback Function</strong>:</p>
<div class="sourceCode" id="cb20">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true"></a><span class="st">&#39;enqueue_assets&#39;</span> =&gt; <span class="kw">function</span><span class="ot">()</span> {</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true"></a>    wp_enqueue_style<span class="ot">(</span><span class="st">&#39;testimonial-block&#39;</span><span class="ot">,</span> get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.css&#39;</span><span class="ot">);</span></span>
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true"></a>    wp_enqueue_script<span class="ot">(</span><span class="st">&#39;testimonial-block&#39;</span><span class="ot">,</span> get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/blocks/testimonial.js&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;jquery&#39;</span><span class="ot">),</span> <span class="st">&#39;1.0&#39;</span><span class="ot">,</span> <span class="kw">true</span><span class="ot">);</span></span>
<span id="cb20-4"><a href="#cb20-4" aria-hidden="true"></a>}</span></code></pre>
</div>
<h2 id="render-callback">Render Callback</h2>
<p><strong>Use Function Instead of Template</strong>:</p>
<div class="sourceCode" id="cb21">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true"></a><span class="st">&#39;render_callback&#39;</span> =&gt; <span class="st">&#39;mytheme_render_testimonial&#39;</span></span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true"></a></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true"></a><span class="kw">function</span> mytheme_render_testimonial<span class="ot">(</span><span class="kw">$block</span><span class="ot">,</span> <span class="kw">$content</span> = <span class="st">&#39;&#39;</span><span class="ot">,</span> <span class="kw">$is_preview</span> = <span class="kw">false</span><span class="ot">,</span> <span class="kw">$post_id</span> = <span class="dv">0</span><span class="ot">)</span> {</span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true"></a>    <span class="kw">$author</span> = get_field<span class="ot">(</span><span class="st">&#39;author&#39;</span><span class="ot">);</span></span>
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true"></a>    <span class="kw">$quote</span> = get_field<span class="ot">(</span><span class="st">&#39;quote&#39;</span><span class="ot">);</span></span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true"></a></span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true"></a>    <span class="kw">echo</span> <span class="st">&#39;&lt;div class=&quot;testimonial-block&quot;&gt;&#39;</span><span class="ot">;</span></span>
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true"></a>    <span class="kw">echo</span> <span class="st">&#39;&lt;blockquote&gt;&#39;</span> . esc_html<span class="ot">(</span><span class="kw">$quote</span><span class="ot">)</span> . <span class="st">&#39;&lt;/blockquote&gt;&#39;</span><span class="ot">;</span></span>
<span id="cb21-9"><a href="#cb21-9" aria-hidden="true"></a>    <span class="kw">echo</span> <span class="st">&#39;&lt;cite&gt;&#39;</span> . esc_html<span class="ot">(</span><span class="kw">$author</span><span class="ot">)</span> . <span class="st">&#39;&lt;/cite&gt;&#39;</span><span class="ot">;</span></span>
<span id="cb21-10"><a href="#cb21-10" aria-hidden="true"></a>    <span class="kw">echo</span> <span class="st">&#39;&lt;/div&gt;&#39;</span><span class="ot">;</span></span>
<span id="cb21-11"><a href="#cb21-11" aria-hidden="true"></a>}</span></code></pre>
</div>
<h2 id="block-wrapper-attributes">Block Wrapper Attributes</h2>
<p><strong>Add Custom Attributes</strong>:</p>
<div class="sourceCode" id="cb22">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true"></a><span class="kw">&lt;?php</span></span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true"></a><span class="kw">$block_attributes</span> = get_block_wrapper_attributes<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true"></a>    <span class="st">&#39;class&#39;</span> =&gt; <span class="st">&#39;additional-class&#39;</span><span class="ot">,</span></span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true"></a>    <span class="st">&#39;data-custom&#39;</span> =&gt; <span class="st">&#39;value&#39;</span><span class="ot">,</span></span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true"></a><span class="ot">));</span></span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true"></a><span class="kw">?&gt;</span></span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true"></a></span>
<span id="cb22-8"><a href="#cb22-8" aria-hidden="true"></a>&lt;div &lt;<span class="ot">?</span>php <span class="kw">echo</span> <span class="kw">$block_attributes</span><span class="ot">;</span> <span class="kw">?&gt;</span>&gt;</span>
<span id="cb22-9"><a href="#cb22-9" aria-hidden="true"></a>    &lt;!-- Block content --&gt;</span>
<span id="cb22-10"><a href="#cb22-10" aria-hidden="true"></a>&lt;/div&gt;</span></code></pre>
</div>
<h2 id="restrict-block-to-post-types">Restrict Block to Post Types</h2>
<p><strong>Limit Where Block Appears</strong>:</p>
<div class="sourceCode" id="cb23">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true"></a><span class="st">&#39;post_types&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;post&#39;</span><span class="ot">,</span> <span class="st">&#39;page&#39;</span><span class="ot">)</span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true"></a><span class="st">&#39;post_types&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;portfolio&#39;</span><span class="ot">)</span></span></code></pre>
</div>
<h2 id="multiple-block-instances">Multiple Block Instances</h2>
<p><strong>Control Block Duplication</strong>:</p>
<div class="sourceCode" id="cb24">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true"></a><span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true"></a>    <span class="st">&#39;multiple&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span> <span class="co">// Allow multiple instances</span></span>
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true"></a><span class="ot">)</span></span>
<span id="cb24-4"><a href="#cb24-4" aria-hidden="true"></a></span>
<span id="cb24-5"><a href="#cb24-5" aria-hidden="true"></a><span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb24-6"><a href="#cb24-6" aria-hidden="true"></a>    <span class="st">&#39;multiple&#39;</span> =&gt; <span class="kw">false</span><span class="ot">,</span> <span class="co">// Single instance only</span></span>
<span id="cb24-7"><a href="#cb24-7" aria-hidden="true"></a><span class="ot">)</span></span></code></pre>
</div>
<h2 id="block-templates">Block Templates</h2>
<p><strong>Pre-populate Post with Blocks</strong>:</p>
<div class="sourceCode" id="cb25">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true"></a><span class="kw">function</span> mytheme_register_template<span class="ot">()</span> {</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true"></a>    <span class="kw">$post_type_object</span> = get_post_type_object<span class="ot">(</span><span class="st">&#39;portfolio&#39;</span><span class="ot">);</span></span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true"></a>    <span class="kw">$post_type_object</span>-&gt;template = <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;acf/testimonial&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb25-5"><a href="#cb25-5" aria-hidden="true"></a>            <span class="st">&#39;author&#39;</span> =&gt; <span class="st">&#39;Default Author&#39;</span><span class="ot">,</span></span>
<span id="cb25-6"><a href="#cb25-6" aria-hidden="true"></a>            <span class="st">&#39;quote&#39;</span> =&gt; <span class="st">&#39;Add your testimonial here&#39;</span><span class="ot">,</span></span>
<span id="cb25-7"><a href="#cb25-7" aria-hidden="true"></a>        <span class="ot">)),</span></span>
<span id="cb25-8"><a href="#cb25-8" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;core/paragraph&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb25-9"><a href="#cb25-9" aria-hidden="true"></a>            <span class="st">&#39;placeholder&#39;</span> =&gt; <span class="st">&#39;Add project description...&#39;</span><span class="ot">,</span></span>
<span id="cb25-10"><a href="#cb25-10" aria-hidden="true"></a>        <span class="ot">)),</span></span>
<span id="cb25-11"><a href="#cb25-11" aria-hidden="true"></a>    <span class="ot">);</span></span>
<span id="cb25-12"><a href="#cb25-12" aria-hidden="true"></a>}</span>
<span id="cb25-13"><a href="#cb25-13" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;init&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_register_template&#39;</span><span class="ot">);</span></span></code></pre>
</div>
<h2 id="complete-block-example">Complete Block Example</h2>
<p><strong>Hero Block with Multiple Fields</strong>:</p>
<div class="sourceCode" id="cb26">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true"></a><span class="co">// Registration</span></span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true"></a>acf_register_block_type<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true"></a>    <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;hero&#39;</span><span class="ot">,</span></span>
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true"></a>    <span class="st">&#39;title&#39;</span> =&gt; <span class="kw">__</span><span class="ot">(</span><span class="st">&#39;Hero Section&#39;</span><span class="ot">),</span></span>
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true"></a>    <span class="st">&#39;render_template&#39;</span> =&gt; <span class="st">&#39;blocks/hero.php&#39;</span><span class="ot">,</span></span>
<span id="cb26-6"><a href="#cb26-6" aria-hidden="true"></a>    <span class="st">&#39;category&#39;</span> =&gt; <span class="st">&#39;layout&#39;</span><span class="ot">,</span></span>
<span id="cb26-7"><a href="#cb26-7" aria-hidden="true"></a>    <span class="st">&#39;icon&#39;</span> =&gt; <span class="st">&#39;cover-image&#39;</span><span class="ot">,</span></span>
<span id="cb26-8"><a href="#cb26-8" aria-hidden="true"></a>    <span class="st">&#39;supports&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-9"><a href="#cb26-9" aria-hidden="true"></a>        <span class="st">&#39;align&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span><span class="st">&#39;full&#39;</span><span class="ot">),</span></span>
<span id="cb26-10"><a href="#cb26-10" aria-hidden="true"></a>        <span class="st">&#39;mode&#39;</span> =&gt; <span class="kw">false</span><span class="ot">,</span></span>
<span id="cb26-11"><a href="#cb26-11" aria-hidden="true"></a>    <span class="ot">),</span></span>
<span id="cb26-12"><a href="#cb26-12" aria-hidden="true"></a><span class="ot">));</span></span>
<span id="cb26-13"><a href="#cb26-13" aria-hidden="true"></a></span>
<span id="cb26-14"><a href="#cb26-14" aria-hidden="true"></a><span class="co">// Fields</span></span>
<span id="cb26-15"><a href="#cb26-15" aria-hidden="true"></a>acf_add_local_field_group<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-16"><a href="#cb26-16" aria-hidden="true"></a>    <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;group_hero&#39;</span><span class="ot">,</span></span>
<span id="cb26-17"><a href="#cb26-17" aria-hidden="true"></a>    <span class="st">&#39;title&#39;</span> =&gt; <span class="st">&#39;Hero Block&#39;</span><span class="ot">,</span></span>
<span id="cb26-18"><a href="#cb26-18" aria-hidden="true"></a>    <span class="st">&#39;fields&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-19"><a href="#cb26-19" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-20"><a href="#cb26-20" aria-hidden="true"></a>            <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_hero_title&#39;</span><span class="ot">,</span></span>
<span id="cb26-21"><a href="#cb26-21" aria-hidden="true"></a>            <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Title&#39;</span><span class="ot">,</span></span>
<span id="cb26-22"><a href="#cb26-22" aria-hidden="true"></a>            <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;title&#39;</span><span class="ot">,</span></span>
<span id="cb26-23"><a href="#cb26-23" aria-hidden="true"></a>            <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;text&#39;</span><span class="ot">,</span></span>
<span id="cb26-24"><a href="#cb26-24" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb26-25"><a href="#cb26-25" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-26"><a href="#cb26-26" aria-hidden="true"></a>            <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_hero_subtitle&#39;</span><span class="ot">,</span></span>
<span id="cb26-27"><a href="#cb26-27" aria-hidden="true"></a>            <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Subtitle&#39;</span><span class="ot">,</span></span>
<span id="cb26-28"><a href="#cb26-28" aria-hidden="true"></a>            <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;subtitle&#39;</span><span class="ot">,</span></span>
<span id="cb26-29"><a href="#cb26-29" aria-hidden="true"></a>            <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;text&#39;</span><span class="ot">,</span></span>
<span id="cb26-30"><a href="#cb26-30" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb26-31"><a href="#cb26-31" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-32"><a href="#cb26-32" aria-hidden="true"></a>            <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_hero_bg&#39;</span><span class="ot">,</span></span>
<span id="cb26-33"><a href="#cb26-33" aria-hidden="true"></a>            <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Background Image&#39;</span><span class="ot">,</span></span>
<span id="cb26-34"><a href="#cb26-34" aria-hidden="true"></a>            <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;background_image&#39;</span><span class="ot">,</span></span>
<span id="cb26-35"><a href="#cb26-35" aria-hidden="true"></a>            <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;image&#39;</span><span class="ot">,</span></span>
<span id="cb26-36"><a href="#cb26-36" aria-hidden="true"></a>            <span class="st">&#39;return_format&#39;</span> =&gt; <span class="st">&#39;url&#39;</span><span class="ot">,</span></span>
<span id="cb26-37"><a href="#cb26-37" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb26-38"><a href="#cb26-38" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-39"><a href="#cb26-39" aria-hidden="true"></a>            <span class="st">&#39;key&#39;</span> =&gt; <span class="st">&#39;field_hero_button&#39;</span><span class="ot">,</span></span>
<span id="cb26-40"><a href="#cb26-40" aria-hidden="true"></a>            <span class="st">&#39;label&#39;</span> =&gt; <span class="st">&#39;Button&#39;</span><span class="ot">,</span></span>
<span id="cb26-41"><a href="#cb26-41" aria-hidden="true"></a>            <span class="st">&#39;name&#39;</span> =&gt; <span class="st">&#39;button&#39;</span><span class="ot">,</span></span>
<span id="cb26-42"><a href="#cb26-42" aria-hidden="true"></a>            <span class="st">&#39;type&#39;</span> =&gt; <span class="st">&#39;link&#39;</span><span class="ot">,</span></span>
<span id="cb26-43"><a href="#cb26-43" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb26-44"><a href="#cb26-44" aria-hidden="true"></a>    <span class="ot">),</span></span>
<span id="cb26-45"><a href="#cb26-45" aria-hidden="true"></a>    <span class="st">&#39;location&#39;</span> =&gt; <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-46"><a href="#cb26-46" aria-hidden="true"></a>        <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-47"><a href="#cb26-47" aria-hidden="true"></a>            <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb26-48"><a href="#cb26-48" aria-hidden="true"></a>                <span class="st">&#39;param&#39;</span> =&gt; <span class="st">&#39;block&#39;</span><span class="ot">,</span></span>
<span id="cb26-49"><a href="#cb26-49" aria-hidden="true"></a>                <span class="st">&#39;operator&#39;</span> =&gt; <span class="st">&#39;==&#39;</span><span class="ot">,</span></span>
<span id="cb26-50"><a href="#cb26-50" aria-hidden="true"></a>                <span class="st">&#39;value&#39;</span> =&gt; <span class="st">&#39;acf/hero&#39;</span><span class="ot">,</span></span>
<span id="cb26-51"><a href="#cb26-51" aria-hidden="true"></a>            <span class="ot">),</span></span>
<span id="cb26-52"><a href="#cb26-52" aria-hidden="true"></a>        <span class="ot">),</span></span>
<span id="cb26-53"><a href="#cb26-53" aria-hidden="true"></a>    <span class="ot">),</span></span>
<span id="cb26-54"><a href="#cb26-54" aria-hidden="true"></a><span class="ot">));</span></span></code></pre>
</div>
<p><strong>Template (blocks/hero.php)</strong>:</p>
<div class="sourceCode" id="cb27">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true"></a><span class="kw">&lt;?php</span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true"></a><span class="kw">$title</span> = get_field<span class="ot">(</span><span class="st">&#39;title&#39;</span><span class="ot">);</span></span>
<span id="cb27-3"><a href="#cb27-3" aria-hidden="true"></a><span class="kw">$subtitle</span> = get_field<span class="ot">(</span><span class="st">&#39;subtitle&#39;</span><span class="ot">);</span></span>
<span id="cb27-4"><a href="#cb27-4" aria-hidden="true"></a><span class="kw">$bg_image</span> = get_field<span class="ot">(</span><span class="st">&#39;background_image&#39;</span><span class="ot">);</span></span>
<span id="cb27-5"><a href="#cb27-5" aria-hidden="true"></a><span class="kw">$button</span> = get_field<span class="ot">(</span><span class="st">&#39;button&#39;</span><span class="ot">);</span></span>
<span id="cb27-6"><a href="#cb27-6" aria-hidden="true"></a></span>
<span id="cb27-7"><a href="#cb27-7" aria-hidden="true"></a><span class="kw">$class_name</span> = <span class="st">&#39;hero-block&#39;</span><span class="ot">;</span></span>
<span id="cb27-8"><a href="#cb27-8" aria-hidden="true"></a><span class="kw">if</span> <span class="ot">(</span>!<span class="kw">empty</span><span class="ot">(</span><span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;className&#39;</span><span class="ot">]))</span> {</span>
<span id="cb27-9"><a href="#cb27-9" aria-hidden="true"></a>    <span class="kw">$class_name</span> .= <span class="st">&#39; &#39;</span> . <span class="kw">$block</span><span class="ot">[</span><span class="st">&#39;className&#39;</span><span class="ot">];</span></span>
<span id="cb27-10"><a href="#cb27-10" aria-hidden="true"></a>}</span>
<span id="cb27-11"><a href="#cb27-11" aria-hidden="true"></a><span class="kw">?&gt;</span></span>
<span id="cb27-12"><a href="#cb27-12" aria-hidden="true"></a></span>
<span id="cb27-13"><a href="#cb27-13" aria-hidden="true"></a>&lt;section <span class="kw">class</span>=<span class="st">&quot;&lt;?php echo esc_attr(</span><span class="kw">$class_name</span><span class="st">); ?&gt;&quot;</span></span>
<span id="cb27-14"><a href="#cb27-14" aria-hidden="true"></a>         style=<span class="st">&quot;background-image: url(&lt;?php echo esc_url(</span><span class="kw">$bg_image</span><span class="st">); ?&gt;);&quot;</span>&gt;</span>
<span id="cb27-15"><a href="#cb27-15" aria-hidden="true"></a>    &lt;div <span class="kw">class</span>=<span class="st">&quot;hero-content&quot;</span>&gt;</span>
<span id="cb27-16"><a href="#cb27-16" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$title</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb27-17"><a href="#cb27-17" aria-hidden="true"></a>            &lt;h1 <span class="kw">class</span>=<span class="st">&quot;hero-title&quot;</span>&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$title</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/h1&gt;</span>
<span id="cb27-18"><a href="#cb27-18" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb27-19"><a href="#cb27-19" aria-hidden="true"></a></span>
<span id="cb27-20"><a href="#cb27-20" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$subtitle</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb27-21"><a href="#cb27-21" aria-hidden="true"></a>            &lt;p <span class="kw">class</span>=<span class="st">&quot;hero-subtitle&quot;</span>&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$subtitle</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/p&gt;</span>
<span id="cb27-22"><a href="#cb27-22" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb27-23"><a href="#cb27-23" aria-hidden="true"></a></span>
<span id="cb27-24"><a href="#cb27-24" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">if</span> <span class="ot">(</span><span class="kw">$button</span><span class="ot">)</span> <span class="ot">:</span> <span class="kw">?&gt;</span></span>
<span id="cb27-25"><a href="#cb27-25" aria-hidden="true"></a>            &lt;a href=<span class="st">&quot;&lt;?php echo esc_url(</span><span class="kw">$button</span><span class="st">[&#39;url&#39;]); ?&gt;&quot;</span></span>
<span id="cb27-26"><a href="#cb27-26" aria-hidden="true"></a>               <span class="kw">class</span>=<span class="st">&quot;hero-button&quot;</span></span>
<span id="cb27-27"><a href="#cb27-27" aria-hidden="true"></a>               target=<span class="st">&quot;&lt;?php echo esc_attr(</span><span class="kw">$button</span><span class="st">[&#39;target&#39;] ?: &#39;_self&#39;); ?&gt;&quot;</span>&gt;</span>
<span id="cb27-28"><a href="#cb27-28" aria-hidden="true"></a>                &lt;<span class="ot">?</span>php <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$button</span><span class="ot">[</span><span class="st">&#39;title&#39;</span><span class="ot">]);</span> <span class="kw">?&gt;</span></span>
<span id="cb27-29"><a href="#cb27-29" aria-hidden="true"></a>            &lt;/a&gt;</span>
<span id="cb27-30"><a href="#cb27-30" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php <span class="kw">endif</span><span class="ot">;</span> <span class="kw">?&gt;</span></span>
<span id="cb27-31"><a href="#cb27-31" aria-hidden="true"></a>    &lt;/div&gt;</span>
<span id="cb27-32"><a href="#cb27-32" aria-hidden="true"></a>&lt;/section&gt;</span></code></pre>
</div>
<h2 id="best-practices">Best Practices</h2>
<p><strong>Organize Block Files</strong>:</p>
<pre><code>theme/
├── blocks/
│   ├── testimonial/
│   │   ├── block.php
│   │   ├── fields.php
│   │   ├── style.css
│   │   └── script.js
│   └── hero/
│       ├── block.php
│       ├── fields.php
│       └── style.css</code></pre>
<p><strong>Use Block Wrapper</strong>:</p>
<div class="sourceCode" id="cb29">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true"></a><span class="co">// Good - uses wrapper</span></span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true"></a>&lt;div &lt;<span class="ot">?</span>php <span class="kw">echo</span> get_block_wrapper_attributes<span class="ot">();</span> <span class="kw">?&gt;</span>&gt;</span>
<span id="cb29-3"><a href="#cb29-3" aria-hidden="true"></a>    &lt;!-- Content --&gt;</span>
<span id="cb29-4"><a href="#cb29-4" aria-hidden="true"></a>&lt;/div&gt;</span>
<span id="cb29-5"><a href="#cb29-5" aria-hidden="true"></a></span>
<span id="cb29-6"><a href="#cb29-6" aria-hidden="true"></a><span class="co">// Better - adds custom classes</span></span>
<span id="cb29-7"><a href="#cb29-7" aria-hidden="true"></a>&lt;<span class="ot">?</span>php</span>
<span id="cb29-8"><a href="#cb29-8" aria-hidden="true"></a><span class="kw">$attributes</span> = get_block_wrapper_attributes<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb29-9"><a href="#cb29-9" aria-hidden="true"></a>    <span class="st">&#39;class&#39;</span> =&gt; <span class="st">&#39;custom-class&#39;</span><span class="ot">,</span></span>
<span id="cb29-10"><a href="#cb29-10" aria-hidden="true"></a><span class="ot">));</span></span>
<span id="cb29-11"><a href="#cb29-11" aria-hidden="true"></a><span class="kw">?&gt;</span></span>
<span id="cb29-12"><a href="#cb29-12" aria-hidden="true"></a>&lt;div &lt;<span class="ot">?</span>php <span class="kw">echo</span> <span class="kw">$attributes</span><span class="ot">;</span> <span class="kw">?&gt;</span>&gt;</span>
<span id="cb29-13"><a href="#cb29-13" aria-hidden="true"></a>    &lt;!-- Content --&gt;</span>
<span id="cb29-14"><a href="#cb29-14" aria-hidden="true"></a>&lt;/div&gt;</span></code></pre>
</div>
<p><strong>Escape Output</strong>:</p>
<div class="sourceCode" id="cb30">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true"></a><span class="kw">&lt;?php</span> <span class="kw">echo</span> esc_html<span class="ot">(</span><span class="kw">$text</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true"></a><span class="kw">&lt;?php</span> <span class="kw">echo</span> esc_url<span class="ot">(</span><span class="kw">$url</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true"></a><span class="kw">&lt;?php</span> <span class="kw">echo</span> esc_attr<span class="ot">(</span><span class="kw">$attribute</span><span class="ot">);</span> <span class="kw">?&gt;</span></span></code></pre>
</div>
<h2 id="conclusion">Conclusion</h2>
<p>ACF Blocks enable custom Gutenberg block creation through PHP registration eliminating React JavaScript requirements while maintaining block editor flexibility. Register blocks with acf_register_block_type(), create field groups targeting specific blocks, render with PHP templates accessing fields via get_field(), and implement block supports for alignment, modes, and InnerBlocks. ACF Blocks combine familiar ACF workflows with modern block editor capabilities creating maintainable custom WordPress blocks through PHP.</p>
<h2 id="external-links">External Links</h2>
<ol type="1">
<li><a href="https://www.advancedcustomfields.com/resources/blocks/">ACF Blocks Documentation</a></li>
<li><a href="https://www.advancedcustomfields.com/resources/acf_register_block_type/">acf_register_block_type() Function</a></li>
<li><a href="https://developer.wordpress.org/block-editor/reference-guides/block-api/block-templates/">Block Templates</a></li>
<li><a href="https://developer.wordpress.org/block-editor/reference-guides/components/inner-blocks/">InnerBlocks</a></li>
<li><a href="https://developer.wordpress.org/reference/functions/get_block_wrapper_attributes/">Block Wrapper Attributes</a></li>
</ol>
<h2 id="call-to-action">Call to Action</h2>
<p>Custom block configurations need backup protection. <a href="https://backupcopilotplugin.com/">Backup Copilot Pro</a> backs up your WordPress ACF block files and field configurations automatically. Safeguard your Gutenberg blocks—start your free 30-day trial today!</p>
<p>The post <a href="https://developryplugins.com/acf-and-gutenberg-integrating-custom-fields-with-block-editor/">ACF and Gutenberg: Integrating Custom Fields with Block Editor</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
