How to render initial posts on page load in a Gutenberg block using the Interactivity API?

You could consider running actions.getPosts on mount via data-wp-init like: <div … data-wp-init=”actions.getPosts”> As per the documentation: This directive runs a callback only when the node is created. You could also consider server-rendering the initial set of posts, like: <div data-wp-watch=”callbacks.renderContent”> <?php $query = new WP_Query( array( … ) ); ?> <?php while( $query->have_posts() ) … Read more

How to auto rename JS files to prevent browser cache issues

The function wp_enqueue_script takes a parameter $ver that you can use to automatically add an version parameter to the URL. To always load the newest version of your Javascript-File, you can use the php filemtime-function to give the timestamp of the modification date. In a Plugin, use like this: wp_register_script( ‘my-awesome-script’, plugin_dir_url( __FILE__ ). ‘assets/my-awesome-script.js’, … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edueduedusedusedueduedusedueduedu