<?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>Food Blogger Mania &#187; WP</title>
	<atom:link href="https://foodbloggermania.it/tag/ricette/wp/feed/" rel="self" type="application/rss+xml" />
	<link>https://foodbloggermania.it</link>
	<description>Food Blogger Mania</description>
	<lastBuildDate>Fri, 24 Apr 2026 14:56:06 +0000</lastBuildDate>
	<language>it-IT</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-3/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-3/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>fucinaidee</dc:creator>
				<category><![CDATA[Veneto]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[Mario Santos]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-3/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-3/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-4/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-4/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>ricette da coinquiline</dc:creator>
				<category><![CDATA[Campania]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-4/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-4/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-5/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-5/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>Ragazze conTorte</dc:creator>
				<category><![CDATA[Lazio]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-5/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-5/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-6/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-6/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>Pani cunzatu</dc:creator>
				<category><![CDATA[Sicilia]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-6/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-6/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-7/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-7/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>Alveare Delle Delizie</dc:creator>
				<category><![CDATA[Friuli Venezia Giulia]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-7/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-7/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-8/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-8/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>BucciaDiArancia</dc:creator>
				<category><![CDATA[Piemonte]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-8/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-8/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-9/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-9/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>claudialuca90</dc:creator>
				<category><![CDATA[Sicilia]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-9/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-9/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-10/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-10/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>Gemma archeologa tra i fornelli.</dc:creator>
				<category><![CDATA[Toscana]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-10/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-10/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making 43% of the Web More Dynamic with the WordPress Interactivity API</title>
		<link>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-11/</link>
		<comments>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-11/#comments</comments>
		<pubDate>Wed, 17 Apr 2024 12:00:00 +0000</pubDate>
		<dc:creator>santox89</dc:creator>
				<category><![CDATA[Campania]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Image Block]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unlike Alpine]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-11/</guid>
		<description><![CDATA[Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place&#160;<a href="https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-11/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.</p>
<p>But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance.&nbsp;</p>
<p>Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core.&nbsp;</p>
<p>The Interactivity API started as <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/block-interactivity-experiments/">an experimental plugin in early 2022</a>, became <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">an official proposal in March 2023</a>, and was finally <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.org/documentation/wordpress-version/version-6-5/#bring-interactions-to-blocks-with-the-interactivity-api">merged into WordPress core with the release of WordPress 6.5 on April 2, 2024</a>. <strong>It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.</strong></p>
<h2>ELI5: The Interactivity API and the Image Block</h2>
<p>Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/support/wordpress-editor/blocks/image-block/">Image block</a>, in particular, is a great way to show off the Interactivity API in action.&nbsp;</p>
<p>At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/index.php#L196">the Interactivity API launches a lightbox</a> showing a high-resolution version of the image.</p>
<p>The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the <code>wp-on--click directive</code> to the image element, referencing the <code>showLightbox</code> action in <code>view.js</code>.</p>
<p>You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/blob/e1842bb8dadd224ccf2e7499bcff781afb9ce499/packages/block-library/src/image/view.js#L38">here in the store object</a>.</p>
<div>
<pre>
actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

</pre>
</div>
<p>The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.</p>
<p>This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.</p>
<p>With the Interactivity API, <strong>developers have a predictable way to provide interactivity to users on the front-end</strong>. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries <em>are</em> included.</p>
<h2>How is the Interactivity API different from Alpine, React, or Vue?</h2>
<p>Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?</p>
<p><strong>At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.</strong></p>
<p>Mario Santos, a developer on the WordPress core team, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">wrote in the Interactivity API proposal</a> that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”</p>
<p>The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.</p>
<p>For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/">Five goals shaped the core development team’s decisions</a> as they built the API:&nbsp;</p>
<ol>
<li><strong>Block-first and PHP-first: </strong>Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.</li>
<li><strong>Backward-compatible: </strong>Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.</li>
<li><strong>Declarative and reactive: </strong>Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.</li>
<li><strong>Performant: </strong>Optimizing runtime performance to deliver a fast and lightweight user experience.</li>
<li><strong>Send less JavaScript: </strong>Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.&nbsp; So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.</li>
</ol>
<p>Other goals are on the horizon, including improvements to client-side navigation, as you can <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/pull/59707">see in this PR</a>.</p>
<h3>Interactivity API vs. Alpine</h3>
<p>The Interactivity API shares a few similarities to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://alpinejs.dev/">Alpine</a>—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://laravel.com/">Laravel</a> projects.</p>
<p>Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. <em>Unlike</em> Alpine, the Interactivity API is designed to seamlessly integrate with WordPress <em>and</em> support server-side rendering of its directives.</p>
<p>With the interactivity API, you can easily generate the view from the server in PHP, and <em>then</em> add client-side interactivity. <strong>This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers.&nbsp;</strong></p>
<p>So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.</p>
<h3>Interactivity API vs. React and Vue</h3>
<p>Many developers have opted for <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://react.dev/">React</a> when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.</p>
<p>Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”</p>
<p>Part of the goal in developing the Interactivity API was the need to <strong>write as little as little JavaScript as possible</strong>, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.</p>
<p>The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://vuejs.org/">Vue</a> to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.</p>
<p>For these reasons, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#why-preact">among others</a>, the core team preferred <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://preactjs.com/">Preact</a>—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.</p>
<p>Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#comment-44595">in this comment on the original proposal</a>.</p>
<p><strong>Preact only loads if the page source contains an interactive block</strong>, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping <em>no</em> JavaScript as a default).</p>
<p>In the original Interactivity API proposal, you can see the <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/#approaches-considered">run-down and comparison of several frameworks</a> and why Preact was chosen over the others.</p>
<h2>What does the new Interactivity API provide to WordPress developers?</h2>
<p>In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.</p>
<figure><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/"><img width="1084" height="2048" src="https://en-blog.files.wordpress.com/2024/04/wordpress-interactivity-api-standard-table.png" alt="a table showing the differences of developing interactive elements on WordPress with and without a standard" class="wp-image-60877" style="width:840px;height:auto" /></a><br />
<figcaption><em>Graphic from <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org</a></em></figcaption>
</figure>
<h3>Directives</h3>
<p>Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">lists all the available directives</a>.</p>
<p>These directives are typically added in the block’s <code>render.php</code> file, and they support all of the WordPress APIs, including <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/actions/">actions</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/plugins/hooks/filters/">filters</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/reference/functions/translations_api/">core translation</a> APIs.&nbsp;</p>
<p>Here’s the render file of a sample block. Notice the click event (<code>data-wp-on--click="actions.toggle"</code>), and how we bind the value of the aria-expanded attributes via directives.</p>
<div>
<pre>
&lt;div
	&lt;?php echo get_block_wrapper_attributes(); ?&gt;
	data-wp-interactive=&quot;create-block&quot;
	&lt;?php echo wp_interactivity_data_wp_context( array( &#039;isOpen&#039; =&gt; false ) ); ?&gt;
	data-wp-watch=&quot;callbacks.logIsOpen&quot;
&gt;
	&lt;button
		data-wp-on--click=&quot;actions.toggle&quot;
		data-wp-bind--aria-expanded=&quot;context.isOpen&quot;
		aria-controls=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
	&gt;
		&lt;?php esc_html_e( &#039;Toggle&#039;, &#039;my-interactive-block&#039; ); ?&gt;
	&lt;/button&gt;

	&lt;p
		id=&quot;&lt;?php echo esc_attr( $unique_id ); ?&gt;&quot;
		data-wp-bind--hidden=&quot;!context.isOpen&quot;
	&gt;
		&lt;?php
			esc_html_e( &#039;My Interactive Block - hello from an interactive block!&#039;, &#039;my-interactive-block&#039; );
		?&gt;
	&lt;/p&gt;
&lt;/div&gt;

</pre>
</div>
<p>Do you need to dynamically update an element&#8217;s inner text? The Interactivity API allows you to use <code>data-wp-text</code> on an element, just like you can use v-text in Vue.</p>
<p>You can bind a value to a boolean or string using <code>wp-bind–</code> or hook up a click event by using <code>data-wp-on–click</code> on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.</p>
<h3>Handling state, side effects, and actions</h3>
<p>The second stage of adding interactivity is to create a store, which is usually done in your <code>view.js</code> file. In the store, you’ll have access to the same context as in your <code>render.php</code> file.</p>
<p>In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.</p>
<div>
<pre>
import { store, getContext } from &#039;@wordpress/interactivity&#039;;

store( &#039;create-block&#039;, {
	actions: {
		toggle: () =&gt; {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () =&gt; {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );
</pre>
</div>
<h2>Try it out for yourself</h2>
<p>The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API.&nbsp;</p>
<p>If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:</p>
<div>
<pre>
npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 
</pre>
</div>
<p>This will give you an example interactive block, with directives and state handling set up.&nbsp;</p>
<p>You can then play around with this locally, using <code>wp-env</code>, using a staging site, or by uploading the plugin directly to your site running <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/hosting/?ref=blog#pricing-grid">a plugin-eligible WordPress.com plan</a>.&nbsp;</p>
<p>If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/18/github-deployments/">our new GitHub Deployments</a> feature! Developing custom blocks is the perfect use case for this new tool.</p>
<p>The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:</p>
<ul>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/news/2024/04/11/a-first-look-at-the-interactivity-api/">A first look at the Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wpmovies.dev/">Interactivity API WP Movies demo</a> and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/wp-movies-demo/blob/main/README.md">demo video</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/issues/60219">Follow along with this task</a> for improvements coming to the Interactivity API</li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#list-of-directives">Block editor reference</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/">Proposal: Interactivity API</a></li>
<li><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://github.com/WordPress/gutenberg/discussions/55642">GitHub issue for showcase</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/making-43-of-the-web-more-dynamic-with-the-wordpress-interactivity-api-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 WordPress Influencers to Follow in 2024  </title>
		<link>https://foodbloggermania.it/ricetta/10-wordpress-influencers-to-follow-in-2024-2/</link>
		<comments>https://foodbloggermania.it/ricetta/10-wordpress-influencers-to-follow-in-2024-2/#comments</comments>
		<pubDate>Tue, 09 Apr 2024 19:18:02 +0000</pubDate>
		<dc:creator>fucinaidee</dc:creator>
				<category><![CDATA[Veneto]]></category>
		<category><![CDATA[Gutenberg Changelog]]></category>
		<category><![CDATA[Gutenberg Times]]></category>
		<category><![CDATA[Jamie Marsland]]></category>
		<category><![CDATA[Jamie Remkus]]></category>
		<category><![CDATA[Matt Medeiros]]></category>
		<category><![CDATA[Rich Tabor]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/10-wordpress-influencers-to-follow-in-2024-2/</guid>
		<description><![CDATA[In this “Build and Beyond” video, Jamie Marsland highlights 10 WordPressers to keep an eye on in 2024.&#160; A couple of weeks ago, we shared a list of 15 WordPress developers you should follow to stay on top of WordPress development news and tips. This video broadens the scope and features folks worth following, regardless&#160;<a href="https://foodbloggermania.it/ricetta/10-wordpress-influencers-to-follow-in-2024-2/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<figure>
<div>
<div></div>
</div>
</figure>
<p>In this “Build and Beyond” video, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.pootlepress.com/about-pootlepress/" rel="nofollow">Jamie Marsland</a> highlights 10 WordPressers to keep an eye on in 2024.&nbsp;</p>
<p>A couple of weeks ago, we shared a list of <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/blog/2024/03/26/wordpress-developers-to-follow-2024/">15 WordPress developers you should follow</a> to stay on top of WordPress development news and tips. This video broadens the scope and features folks worth following, regardless of your role or experience with WordPress. If you’re at all interested in or curious about WordPress, these are folks to pay attention to.</p>
<p>Interested in a free trial that allows you to test our all that WordPress.com has to offer? Click below: </p>
<div>
<div><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wordpress.com/jamie?ref=blog">WordPress.com/Jamie</a></div>
</div>
<div>
<figure><img width="898" height="898" src="https://en-blog.files.wordpress.com/2024/04/remkus-devries.jpeg?w=898" alt="" class="wp-image-60727 size-full" /></figure>
<div>
<h3><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://remkusdevries.com/">Remkus de Vries</a></h3>
<p>Remkus is a well-known figure in the WordPress community, recognized for his contributions to WordPress development and his overall expertise in web technology.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://remkusdevries.com/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@remkusdevries">YouTube</a></p>
</div>
</div>
<div>
<figure><img width="900" height="900" src="https://en-blog.files.wordpress.com/2024/04/kevin-geary.jpeg?w=900" alt="" class="wp-image-60729 size-full" /></figure>
<div>
<h3><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://geary.co/">Kevin Geary</a></h3>
<p>Kevin helps digital agency owners, freelancers, and web designers to learn best practices for UX/UI design, development, and CSS.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://geary.co/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@Gearyco">YouTube</a></p>
</div>
</div>
<div></div>
<div>
<figure><img width="900" height="900" src="https://en-blog.files.wordpress.com/2024/04/tyler-moore.jpeg?w=900" alt="" class="wp-image-60763 size-full" /></figure>
<div>
<h3><strong><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=http://tyler.com">Tyler Moore</a></strong></strong></h3>
<p>Tyler has free video lessons on YouTube that teach people how to create their own professional website without any coding experience.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=http://tyler.com">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/channel/UCvG9V9e1s2lN-hoWeHsDCJQ">YouTube</a></p>
</div>
</div>
<div>
<figure><img width="824" height="694" src="https://en-blog.files.wordpress.com/2024/04/screen-shot-2024-04-09-at-9.50.10-am.png?w=824" alt="" class="wp-image-60733 size-full" /></figure>
<div>
<h3><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://gutenbergtimes.com">Sabrina Zeidan</a></h3>
<p>Sabrina is a WordPress performance engineer, who’s daily work is to speed up WordPress websites, plugins, and themes.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@SabrinaZeidan">YouTube</a></p>
</div>
</div>
<div>
<figure><img width="720" height="717" src="https://en-blog.files.wordpress.com/2024/04/mike-mcalister-1.jpeg?w=720" alt="" class="wp-image-60738 size-full" /></figure>
<div>
<h3><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://mikemcalister.com/">Mike McAlister</a></h3>
<p>Mike is a designer and principal software engineer from the USA. He builds killer products and brands that people love, including the fantastic Ollie WordPress theme.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://mikemcalister.com/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://twitter.com/mikemcalister">X (Twitter)</a></p>
</div>
</div>
<div>
<figure><img width="225" height="225" src="https://en-blog.files.wordpress.com/2024/04/jonathan-jernigan.jpeg?w=225" alt="" class="wp-image-60741 size-full" /></figure>
<div>
<h3><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://jonathanjernigan.com/">Jonathan Jernigan</a></h3>
<p>Jonathan runs a small web development agency, creates courses, and makes YouTube videos. He started is WordPress-focused YouTube channel in late 2018.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://jonathanjernigan.com/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@Permaslug">YouTube</a></p>
</div>
</div>
<div>
<figure><img width="360" height="360" src="https://en-blog.files.wordpress.com/2024/04/birgit-pauli-haack.jpeg?w=360" alt="" class="wp-image-60743 size-full" /></figure>
<div>
<h3><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://gutenbergtimes.com">Birgit Pauli-Haack</a></strong></h3>
<p>Birgit works as developer advocate for WordPress, curates community voices on <em>Gutenberg Times</em>, and co-hosts the <em><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://pca.st/7O43">Gutenberg Changelog</a></em> podcast.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://gutenbergtimes.com">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://twitter.com/bph">X (Twitter)</a></p>
</div>
</div>
<div></div>
<div>
<figure><img width="720" height="720" src="https://en-blog.files.wordpress.com/2024/04/david-mccan.jpeg?w=720" alt="" class="wp-image-60750 size-full" /></figure>
<div>
<h3><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.davidmccan.com/">David McCan</a></strong></h3>
<p>For the past 20 years David has worked professionally developing websites and in IT management.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.davidmccan.com/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.facebook.com/groups/dynamicwordpress">Facebook</a></p>
</div>
</div>
<div>
<figure><img width="956" height="955" src="https://en-blog.files.wordpress.com/2024/04/paul-charlton.png?w=956" alt="" class="wp-image-60753 size-full" /></figure>
<div>
<h3><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wptuts.co.uk/">Paul Charlton</a></strong></h3>
<p>Paul has over 15 years of commercial web design and development experience working on a large range of diverse projects, with clients ranging from start-ups to blue-chip companies.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wptuts.co.uk/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@WPTuts">YouTube</a></p>
</div>
</div>
<div>
<figure><img width="605" height="603" src="https://en-blog.files.wordpress.com/2024/04/matt-medeiros.jpeg?w=605" alt="" class="wp-image-60758 size-full" /></figure>
<div>
<h3><strong><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://thewpminute.com/">Matt Medeiros</a></strong></strong></h3>
<p>The WP Minute, founded by Matt, is a website dedicated to delivering the most important news and topics from the WordPress ecosystem, keeping WordPress professionals informed, educated, and entertained.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://thewpminute.com/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://thewpminute.com/category/wp-minute-podcast/">Podcast</a></p>
</div>
</div>
<div>
<figure><img width="900" height="900" src="https://en-blog.files.wordpress.com/2024/04/imran-sadiq.jpeg?w=900" alt="" class="wp-image-60761 size-full" /></figure>
<div>
<h3><strong><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://websquadron.co.uk/">Imran Sadiq</a></strong></strong></h3>
<p>Imran has 17+ years of web design and marketing experience. His <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@WebSquadron">YouTube channel</a> has over 55k YouTube subscribers.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://websquadron.co.uk/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@WebSquadron">YouTube</a></p>
</div>
</div>
<div></div>
<div>
<figure><img width="1024" height="1024" src="https://en-blog.files.wordpress.com/2024/04/rich-tabor.png?w=1024" alt="" class="wp-image-60765 size-full" /></figure>
<div>
<h3><strong><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://rich.blog/">Rich Tabor</a></strong></strong></h3>
<p>Rich describes himself as a multidisciplinary maker specializing in the intersection of product, design, and engineering.</p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://rich.blog/">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://twitter.com/richard_tabor">X (Twitter)</a></p>
</div>
</div>
<div>
<figure><img width="900" height="900" src="https://en-blog.files.wordpress.com/2024/04/jamie-marsland.jpeg?w=900" alt="" class="wp-image-60767 size-full" /></figure>
<div>
<h3><strong><strong><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.pootlepress.com/about-pootlepress/" rel="nofollow">Jamie Marsland</a></strong></strong></h3>
<p>Jamie has trained over 5,000 people on WordPress in the past 10 years, and he also makes WordPress plugins. His <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@jamiewp">YouTube channel</a> is dedicated to helping people with WordPress Blocks. </p>
<p><a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.pootlepress.com/about-pootlepress/" rel="nofollow">Website</a> | <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/@jamiewp">YouTube</a></p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/10-wordpress-influencers-to-follow-in-2024-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Asia 2024: The WordPress Community Comes Together in Taipei</title>
		<link>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei/</link>
		<comments>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei/#comments</comments>
		<pubDate>Wed, 13 Mar 2024 16:30:40 +0000</pubDate>
		<dc:creator>BucciaDiArancia</dc:creator>
				<category><![CDATA[Piemonte]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Asia]]></category>
		<category><![CDATA[CEO]]></category>
		<category><![CDATA[Contributor Day]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei/</guid>
		<description><![CDATA[This year’s WordCamp Asia was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet. The event kicked off with&#160;<a href="https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>This year’s <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/">WordCamp Asia</a> was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png?w=1024" alt="" class="wp-image-58239" style="width:752px;height:auto" /></a></figure>
</div>
<p>The event kicked off with Contributor Day, an opportunity for anyone in the WordPress community, from newcomers to seasoned experts, to get involved and contribute to WordPress. Contributing can mean contributing to code, but it can also mean sharing your expertise in design, offering support in forums, translating content, and much much more. This year’s Contributor Day had a fantastic turnout and it was amazing to see so many folks show up and participate! </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1178.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1178.png?w=768" alt="" class="wp-image-58241" style="width:516px;height:auto" /></a></figure>
</div>
<p>As always, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/schedule/">there was a variety of informative and inspiring talks</a>. Some of our favorites included talks about the future of WordPress, the multifaceted nature of design, building and maintaining WordPress sites with AI, achieving efficient workflows with the site editor, and the importance of diversity, equity, inclusion, and belonging in the tech and WordPress communities. If any of these topics pique your interest, you can take a look at the livestream recordings for these and all other WordCamp Asia 2024 talks <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/playlist?list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU">here</a>. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1360.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1360.png?w=1024" alt="" class="wp-image-58243" style="width:719px;height:auto" /></a></figure>
</div>
<p>While our colleagues from the WordPress Project, Woo, and Jetpack participated in the event, folks from WordPress.com were also present, contributing, networking, and engaging with the community. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1342.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1342.png?w=768" alt="" class="wp-image-58244" style="width:477px;height:auto" /></a></figure>
</div>
<p>This year we were particularly interested in connecting with developers so that we could better understand their experiences with WordPress.com. Our hosting infrastructure, powered by <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wp.cloud/">WP Cloud</a>, is best-in-class, yet the benefits aren’t as well-known in the developer community. To help get the word out about all of our developer-focused features, we’ve recently relaunched our developer site at <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/">developer.wordpress.com</a>. Check it out to learn about <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/staging-sites/">staging sites</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/wp-cli/">WP-CLI access</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/studio/">Studio</a>, our upcoming local development environment. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1628.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1628.png?w=1024" alt="" class="wp-image-58246" style="width:706px;height:auto" /></a></figure>
</div>
<p>During the anticipated <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/watch?v=EOF70YJLC5U&amp;list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU&amp;index=9&amp;ab_channel=WordPress">closing Q&amp;A session</a> at WordCamp Asia 2024, Matt Mullenweg, co-founder of WordPress and CEO of Automattic, opened up about his dreams for a web that&#8217;s both open and accessible to everyone. He shared how the core principles of open source are not just shaping WordPress but also knitting together a worldwide community of contributors.</p>
<p>That sense of community is something you can definitely feel at WordCamps. Thirty-six percent of attendees at this WordCamp were first-time participants—a testament to the event&#8217;s growing appeal and the ever-expanding WordPress community.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1369.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1369.png?w=1024" alt="" class="wp-image-58248" style="width:721px;height:auto" /></a></figure>
</div>
<p>During the closing remarks, Matt revealed that State of the Word 2024 will be held in Tokyo, Japan. The lead organizers also revealed the next WordCamp Asia location: Manila, Philippines, in February 2025. With Manila&#8217;s rich tapestry of Spanish, European, American, and Asian influences, we’re in for a vibrant mix of culture, cuisine, and community!</p>
<p>But you don’t have to wait until 2025 to start getting involved. There&#8217;s a huge number of local and regional WordCamps happening year-round. Head over to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://central.wordcamp.org/">https://central.wordcamp.org/</a> to find one near you. Whether you’re looking to develop your skills, learn something new, network with the community, there’s something for everyone. We hope to see you out there!&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Asia 2024: The WordPress Community Comes Together in Taipei</title>
		<link>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-2/</link>
		<comments>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-2/#comments</comments>
		<pubDate>Wed, 13 Mar 2024 16:30:40 +0000</pubDate>
		<dc:creator>claudialuca90</dc:creator>
				<category><![CDATA[Sicilia]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Asia]]></category>
		<category><![CDATA[CEO]]></category>
		<category><![CDATA[Contributor Day]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-2/</guid>
		<description><![CDATA[This year’s WordCamp Asia was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet. The event kicked off with&#160;<a href="https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-2/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>This year’s <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/">WordCamp Asia</a> was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png?w=1024" alt="" class="wp-image-58239" style="width:752px;height:auto" /></a></figure>
</div>
<p>The event kicked off with Contributor Day, an opportunity for anyone in the WordPress community, from newcomers to seasoned experts, to get involved and contribute to WordPress. Contributing can mean contributing to code, but it can also mean sharing your expertise in design, offering support in forums, translating content, and much much more. This year’s Contributor Day had a fantastic turnout and it was amazing to see so many folks show up and participate! </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1178.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1178.png?w=768" alt="" class="wp-image-58241" style="width:516px;height:auto" /></a></figure>
</div>
<p>As always, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/schedule/">there was a variety of informative and inspiring talks</a>. Some of our favorites included talks about the future of WordPress, the multifaceted nature of design, building and maintaining WordPress sites with AI, achieving efficient workflows with the site editor, and the importance of diversity, equity, inclusion, and belonging in the tech and WordPress communities. If any of these topics pique your interest, you can take a look at the livestream recordings for these and all other WordCamp Asia 2024 talks <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/playlist?list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU">here</a>. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1360.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1360.png?w=1024" alt="" class="wp-image-58243" style="width:719px;height:auto" /></a></figure>
</div>
<p>While our colleagues from the WordPress Project, Woo, and Jetpack participated in the event, folks from WordPress.com were also present, contributing, networking, and engaging with the community. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1342.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1342.png?w=768" alt="" class="wp-image-58244" style="width:477px;height:auto" /></a></figure>
</div>
<p>This year we were particularly interested in connecting with developers so that we could better understand their experiences with WordPress.com. Our hosting infrastructure, powered by <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wp.cloud/">WP Cloud</a>, is best-in-class, yet the benefits aren’t as well-known in the developer community. To help get the word out about all of our developer-focused features, we’ve recently relaunched our developer site at <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/">developer.wordpress.com</a>. Check it out to learn about <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/staging-sites/">staging sites</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/wp-cli/">WP-CLI access</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/studio/">Studio</a>, our upcoming local development environment. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1628.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1628.png?w=1024" alt="" class="wp-image-58246" style="width:706px;height:auto" /></a></figure>
</div>
<p>During the anticipated <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/watch?v=EOF70YJLC5U&amp;list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU&amp;index=9&amp;ab_channel=WordPress">closing Q&amp;A session</a> at WordCamp Asia 2024, Matt Mullenweg, co-founder of WordPress and CEO of Automattic, opened up about his dreams for a web that&#8217;s both open and accessible to everyone. He shared how the core principles of open source are not just shaping WordPress but also knitting together a worldwide community of contributors.</p>
<p>That sense of community is something you can definitely feel at WordCamps. Thirty-six percent of attendees at this WordCamp were first-time participants—a testament to the event&#8217;s growing appeal and the ever-expanding WordPress community.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1369.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1369.png?w=1024" alt="" class="wp-image-58248" style="width:721px;height:auto" /></a></figure>
</div>
<p>During the closing remarks, Matt revealed that State of the Word 2024 will be held in Tokyo, Japan. The lead organizers also revealed the next WordCamp Asia location: Manila, Philippines, in February 2025. With Manila&#8217;s rich tapestry of Spanish, European, American, and Asian influences, we’re in for a vibrant mix of culture, cuisine, and community!</p>
<p>But you don’t have to wait until 2025 to start getting involved. There&#8217;s a huge number of local and regional WordCamps happening year-round. Head over to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://central.wordcamp.org/">https://central.wordcamp.org/</a> to find one near you. Whether you’re looking to develop your skills, learn something new, network with the community, there’s something for everyone. We hope to see you out there!&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Asia 2024: The WordPress Community Comes Together in Taipei</title>
		<link>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-3/</link>
		<comments>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-3/#comments</comments>
		<pubDate>Wed, 13 Mar 2024 16:30:40 +0000</pubDate>
		<dc:creator>Gemma archeologa tra i fornelli.</dc:creator>
				<category><![CDATA[Toscana]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Asia]]></category>
		<category><![CDATA[CEO]]></category>
		<category><![CDATA[Contributor Day]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-3/</guid>
		<description><![CDATA[This year’s WordCamp Asia was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet. The event kicked off with&#160;<a href="https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-3/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>This year’s <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/">WordCamp Asia</a> was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png?w=1024" alt="" class="wp-image-58239" style="width:752px;height:auto" /></a></figure>
</div>
<p>The event kicked off with Contributor Day, an opportunity for anyone in the WordPress community, from newcomers to seasoned experts, to get involved and contribute to WordPress. Contributing can mean contributing to code, but it can also mean sharing your expertise in design, offering support in forums, translating content, and much much more. This year’s Contributor Day had a fantastic turnout and it was amazing to see so many folks show up and participate! </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1178.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1178.png?w=768" alt="" class="wp-image-58241" style="width:516px;height:auto" /></a></figure>
</div>
<p>As always, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/schedule/">there was a variety of informative and inspiring talks</a>. Some of our favorites included talks about the future of WordPress, the multifaceted nature of design, building and maintaining WordPress sites with AI, achieving efficient workflows with the site editor, and the importance of diversity, equity, inclusion, and belonging in the tech and WordPress communities. If any of these topics pique your interest, you can take a look at the livestream recordings for these and all other WordCamp Asia 2024 talks <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/playlist?list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU">here</a>. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1360.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1360.png?w=1024" alt="" class="wp-image-58243" style="width:719px;height:auto" /></a></figure>
</div>
<p>While our colleagues from the WordPress Project, Woo, and Jetpack participated in the event, folks from WordPress.com were also present, contributing, networking, and engaging with the community. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1342.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1342.png?w=768" alt="" class="wp-image-58244" style="width:477px;height:auto" /></a></figure>
</div>
<p>This year we were particularly interested in connecting with developers so that we could better understand their experiences with WordPress.com. Our hosting infrastructure, powered by <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wp.cloud/">WP Cloud</a>, is best-in-class, yet the benefits aren’t as well-known in the developer community. To help get the word out about all of our developer-focused features, we’ve recently relaunched our developer site at <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/">developer.wordpress.com</a>. Check it out to learn about <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/staging-sites/">staging sites</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/wp-cli/">WP-CLI access</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/studio/">Studio</a>, our upcoming local development environment. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1628.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1628.png?w=1024" alt="" class="wp-image-58246" style="width:706px;height:auto" /></a></figure>
</div>
<p>During the anticipated <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/watch?v=EOF70YJLC5U&amp;list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU&amp;index=9&amp;ab_channel=WordPress">closing Q&amp;A session</a> at WordCamp Asia 2024, Matt Mullenweg, co-founder of WordPress and CEO of Automattic, opened up about his dreams for a web that&#8217;s both open and accessible to everyone. He shared how the core principles of open source are not just shaping WordPress but also knitting together a worldwide community of contributors.</p>
<p>That sense of community is something you can definitely feel at WordCamps. Thirty-six percent of attendees at this WordCamp were first-time participants—a testament to the event&#8217;s growing appeal and the ever-expanding WordPress community.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1369.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1369.png?w=1024" alt="" class="wp-image-58248" style="width:721px;height:auto" /></a></figure>
</div>
<p>During the closing remarks, Matt revealed that State of the Word 2024 will be held in Tokyo, Japan. The lead organizers also revealed the next WordCamp Asia location: Manila, Philippines, in February 2025. With Manila&#8217;s rich tapestry of Spanish, European, American, and Asian influences, we’re in for a vibrant mix of culture, cuisine, and community!</p>
<p>But you don’t have to wait until 2025 to start getting involved. There&#8217;s a huge number of local and regional WordCamps happening year-round. Head over to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://central.wordcamp.org/">https://central.wordcamp.org/</a> to find one near you. Whether you’re looking to develop your skills, learn something new, network with the community, there’s something for everyone. We hope to see you out there!&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Asia 2024: The WordPress Community Comes Together in Taipei</title>
		<link>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-4/</link>
		<comments>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-4/#comments</comments>
		<pubDate>Wed, 13 Mar 2024 16:30:40 +0000</pubDate>
		<dc:creator>santox89</dc:creator>
				<category><![CDATA[Campania]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Asia]]></category>
		<category><![CDATA[CEO]]></category>
		<category><![CDATA[Contributor Day]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-4/</guid>
		<description><![CDATA[This year’s WordCamp Asia was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet. The event kicked off with&#160;<a href="https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-4/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>This year’s <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/">WordCamp Asia</a> was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png?w=1024" alt="" class="wp-image-58239" style="width:752px;height:auto" /></a></figure>
</div>
<p>The event kicked off with Contributor Day, an opportunity for anyone in the WordPress community, from newcomers to seasoned experts, to get involved and contribute to WordPress. Contributing can mean contributing to code, but it can also mean sharing your expertise in design, offering support in forums, translating content, and much much more. This year’s Contributor Day had a fantastic turnout and it was amazing to see so many folks show up and participate! </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1178.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1178.png?w=768" alt="" class="wp-image-58241" style="width:516px;height:auto" /></a></figure>
</div>
<p>As always, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/schedule/">there was a variety of informative and inspiring talks</a>. Some of our favorites included talks about the future of WordPress, the multifaceted nature of design, building and maintaining WordPress sites with AI, achieving efficient workflows with the site editor, and the importance of diversity, equity, inclusion, and belonging in the tech and WordPress communities. If any of these topics pique your interest, you can take a look at the livestream recordings for these and all other WordCamp Asia 2024 talks <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/playlist?list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU">here</a>. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1360.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1360.png?w=1024" alt="" class="wp-image-58243" style="width:719px;height:auto" /></a></figure>
</div>
<p>While our colleagues from the WordPress Project, Woo, and Jetpack participated in the event, folks from WordPress.com were also present, contributing, networking, and engaging with the community. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1342.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1342.png?w=768" alt="" class="wp-image-58244" style="width:477px;height:auto" /></a></figure>
</div>
<p>This year we were particularly interested in connecting with developers so that we could better understand their experiences with WordPress.com. Our hosting infrastructure, powered by <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wp.cloud/">WP Cloud</a>, is best-in-class, yet the benefits aren’t as well-known in the developer community. To help get the word out about all of our developer-focused features, we’ve recently relaunched our developer site at <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/">developer.wordpress.com</a>. Check it out to learn about <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/staging-sites/">staging sites</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/wp-cli/">WP-CLI access</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/studio/">Studio</a>, our upcoming local development environment. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1628.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1628.png?w=1024" alt="" class="wp-image-58246" style="width:706px;height:auto" /></a></figure>
</div>
<p>During the anticipated <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/watch?v=EOF70YJLC5U&amp;list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU&amp;index=9&amp;ab_channel=WordPress">closing Q&amp;A session</a> at WordCamp Asia 2024, Matt Mullenweg, co-founder of WordPress and CEO of Automattic, opened up about his dreams for a web that&#8217;s both open and accessible to everyone. He shared how the core principles of open source are not just shaping WordPress but also knitting together a worldwide community of contributors.</p>
<p>That sense of community is something you can definitely feel at WordCamps. Thirty-six percent of attendees at this WordCamp were first-time participants—a testament to the event&#8217;s growing appeal and the ever-expanding WordPress community.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1369.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1369.png?w=1024" alt="" class="wp-image-58248" style="width:721px;height:auto" /></a></figure>
</div>
<p>During the closing remarks, Matt revealed that State of the Word 2024 will be held in Tokyo, Japan. The lead organizers also revealed the next WordCamp Asia location: Manila, Philippines, in February 2025. With Manila&#8217;s rich tapestry of Spanish, European, American, and Asian influences, we’re in for a vibrant mix of culture, cuisine, and community!</p>
<p>But you don’t have to wait until 2025 to start getting involved. There&#8217;s a huge number of local and regional WordCamps happening year-round. Head over to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://central.wordcamp.org/">https://central.wordcamp.org/</a> to find one near you. Whether you’re looking to develop your skills, learn something new, network with the community, there’s something for everyone. We hope to see you out there!&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Asia 2024: The WordPress Community Comes Together in Taipei</title>
		<link>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-5/</link>
		<comments>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-5/#comments</comments>
		<pubDate>Wed, 13 Mar 2024 16:30:40 +0000</pubDate>
		<dc:creator>Ovosodo Cook</dc:creator>
				<category><![CDATA[Emilia Romagna]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Asia]]></category>
		<category><![CDATA[CEO]]></category>
		<category><![CDATA[Contributor Day]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-5/</guid>
		<description><![CDATA[This year’s WordCamp Asia was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet. The event kicked off with&#160;<a href="https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-5/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>This year’s <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/">WordCamp Asia</a> was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png?w=1024" alt="" class="wp-image-58239" style="width:752px;height:auto" /></a></figure>
</div>
<p>The event kicked off with Contributor Day, an opportunity for anyone in the WordPress community, from newcomers to seasoned experts, to get involved and contribute to WordPress. Contributing can mean contributing to code, but it can also mean sharing your expertise in design, offering support in forums, translating content, and much much more. This year’s Contributor Day had a fantastic turnout and it was amazing to see so many folks show up and participate! </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1178.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1178.png?w=768" alt="" class="wp-image-58241" style="width:516px;height:auto" /></a></figure>
</div>
<p>As always, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/schedule/">there was a variety of informative and inspiring talks</a>. Some of our favorites included talks about the future of WordPress, the multifaceted nature of design, building and maintaining WordPress sites with AI, achieving efficient workflows with the site editor, and the importance of diversity, equity, inclusion, and belonging in the tech and WordPress communities. If any of these topics pique your interest, you can take a look at the livestream recordings for these and all other WordCamp Asia 2024 talks <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/playlist?list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU">here</a>. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1360.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1360.png?w=1024" alt="" class="wp-image-58243" style="width:719px;height:auto" /></a></figure>
</div>
<p>While our colleagues from the WordPress Project, Woo, and Jetpack participated in the event, folks from WordPress.com were also present, contributing, networking, and engaging with the community. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1342.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1342.png?w=768" alt="" class="wp-image-58244" style="width:477px;height:auto" /></a></figure>
</div>
<p>This year we were particularly interested in connecting with developers so that we could better understand their experiences with WordPress.com. Our hosting infrastructure, powered by <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wp.cloud/">WP Cloud</a>, is best-in-class, yet the benefits aren’t as well-known in the developer community. To help get the word out about all of our developer-focused features, we’ve recently relaunched our developer site at <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/">developer.wordpress.com</a>. Check it out to learn about <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/staging-sites/">staging sites</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/wp-cli/">WP-CLI access</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/studio/">Studio</a>, our upcoming local development environment. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1628.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1628.png?w=1024" alt="" class="wp-image-58246" style="width:706px;height:auto" /></a></figure>
</div>
<p>During the anticipated <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/watch?v=EOF70YJLC5U&amp;list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU&amp;index=9&amp;ab_channel=WordPress">closing Q&amp;A session</a> at WordCamp Asia 2024, Matt Mullenweg, co-founder of WordPress and CEO of Automattic, opened up about his dreams for a web that&#8217;s both open and accessible to everyone. He shared how the core principles of open source are not just shaping WordPress but also knitting together a worldwide community of contributors.</p>
<p>That sense of community is something you can definitely feel at WordCamps. Thirty-six percent of attendees at this WordCamp were first-time participants—a testament to the event&#8217;s growing appeal and the ever-expanding WordPress community.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1369.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1369.png?w=1024" alt="" class="wp-image-58248" style="width:721px;height:auto" /></a></figure>
</div>
<p>During the closing remarks, Matt revealed that State of the Word 2024 will be held in Tokyo, Japan. The lead organizers also revealed the next WordCamp Asia location: Manila, Philippines, in February 2025. With Manila&#8217;s rich tapestry of Spanish, European, American, and Asian influences, we’re in for a vibrant mix of culture, cuisine, and community!</p>
<p>But you don’t have to wait until 2025 to start getting involved. There&#8217;s a huge number of local and regional WordCamps happening year-round. Head over to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://central.wordcamp.org/">https://central.wordcamp.org/</a> to find one near you. Whether you’re looking to develop your skills, learn something new, network with the community, there’s something for everyone. We hope to see you out there!&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Asia 2024: The WordPress Community Comes Together in Taipei</title>
		<link>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-6/</link>
		<comments>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-6/#comments</comments>
		<pubDate>Wed, 13 Mar 2024 16:30:40 +0000</pubDate>
		<dc:creator>Mariapia</dc:creator>
				<category><![CDATA[Basilicata]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Asia]]></category>
		<category><![CDATA[CEO]]></category>
		<category><![CDATA[Contributor Day]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-6/</guid>
		<description><![CDATA[This year’s WordCamp Asia was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet. The event kicked off with&#160;<a href="https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-6/" class="read-more">Continua a leggere..</a>]]></description>
			<content:encoded><![CDATA[<p>This year’s <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/">WordCamp Asia</a> was held in Taipei, the vibrant capital city of Taiwan. Members from WordPress.com joined other Automatticians, as well as around 2,000 other attendees from across 70 countries to connect, learn, build, and give back to the platform that powers millions of top websites across the internet.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1317-1.png?w=1024" alt="" class="wp-image-58239" style="width:752px;height:auto" /></a></figure>
</div>
<p>The event kicked off with Contributor Day, an opportunity for anyone in the WordPress community, from newcomers to seasoned experts, to get involved and contribute to WordPress. Contributing can mean contributing to code, but it can also mean sharing your expertise in design, offering support in forums, translating content, and much much more. This year’s Contributor Day had a fantastic turnout and it was amazing to see so many folks show up and participate! </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1178.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1178.png?w=768" alt="" class="wp-image-58241" style="width:516px;height:auto" /></a></figure>
</div>
<p>As always, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://asia.wordcamp.org/2024/schedule/">there was a variety of informative and inspiring talks</a>. Some of our favorites included talks about the future of WordPress, the multifaceted nature of design, building and maintaining WordPress sites with AI, achieving efficient workflows with the site editor, and the importance of diversity, equity, inclusion, and belonging in the tech and WordPress communities. If any of these topics pique your interest, you can take a look at the livestream recordings for these and all other WordCamp Asia 2024 talks <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/playlist?list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU">here</a>. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1360.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1360.png?w=1024" alt="" class="wp-image-58243" style="width:719px;height:auto" /></a></figure>
</div>
<p>While our colleagues from the WordPress Project, Woo, and Jetpack participated in the event, folks from WordPress.com were also present, contributing, networking, and engaging with the community. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1342.png"><img width="768" height="1024" src="https://en-blog.files.wordpress.com/2024/03/img_1342.png?w=768" alt="" class="wp-image-58244" style="width:477px;height:auto" /></a></figure>
</div>
<p>This year we were particularly interested in connecting with developers so that we could better understand their experiences with WordPress.com. Our hosting infrastructure, powered by <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://wp.cloud/">WP Cloud</a>, is best-in-class, yet the benefits aren’t as well-known in the developer community. To help get the word out about all of our developer-focused features, we’ve recently relaunched our developer site at <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/">developer.wordpress.com</a>. Check it out to learn about <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/staging-sites/">staging sites</a>, <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/docs/developer-tools/wp-cli/">WP-CLI access</a>, and <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://developer.wordpress.com/studio/">Studio</a>, our upcoming local development environment. </p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1628.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1628.png?w=1024" alt="" class="wp-image-58246" style="width:706px;height:auto" /></a></figure>
</div>
<p>During the anticipated <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://www.youtube.com/watch?v=EOF70YJLC5U&amp;list=PL1pJFUVKQ7ETpYuALlCQPikuKEuihFsvU&amp;index=9&amp;ab_channel=WordPress">closing Q&amp;A session</a> at WordCamp Asia 2024, Matt Mullenweg, co-founder of WordPress and CEO of Automattic, opened up about his dreams for a web that&#8217;s both open and accessible to everyone. He shared how the core principles of open source are not just shaping WordPress but also knitting together a worldwide community of contributors.</p>
<p>That sense of community is something you can definitely feel at WordCamps. Thirty-six percent of attendees at this WordCamp were first-time participants—a testament to the event&#8217;s growing appeal and the ever-expanding WordPress community.</p>
<div>
<figure><a target="_blank" rel="nofollow" href="https://en-blog.files.wordpress.com/2024/03/img_1369.png"><img width="1024" height="768" src="https://en-blog.files.wordpress.com/2024/03/img_1369.png?w=1024" alt="" class="wp-image-58248" style="width:721px;height:auto" /></a></figure>
</div>
<p>During the closing remarks, Matt revealed that State of the Word 2024 will be held in Tokyo, Japan. The lead organizers also revealed the next WordCamp Asia location: Manila, Philippines, in February 2025. With Manila&#8217;s rich tapestry of Spanish, European, American, and Asian influences, we’re in for a vibrant mix of culture, cuisine, and community!</p>
<p>But you don’t have to wait until 2025 to start getting involved. There&#8217;s a huge number of local and regional WordCamps happening year-round. Head over to <a target="_blank" rel="nofollow" href="/redirect.php?URL=https://central.wordcamp.org/">https://central.wordcamp.org/</a> to find one near you. Whether you’re looking to develop your skills, learn something new, network with the community, there’s something for everyone. We hope to see you out there!&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://foodbloggermania.it/ricetta/wordcamp-asia-2024-the-wordpress-community-comes-together-in-taipei-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- Wp Fastest Cache: XML Content -->