npm init -y
Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.
<script type="text/html" id="tmpl-alm-template"> | |
<li <# if(!data.thumbnail){ #> class="no-img" <# } #>> | |
<# if(data.thumbnail){ #> | |
<a href="{{{data.link}}}"><img src="{{{data.thumbnail}}}" alt="{{{data.thumbnail_alt}}}" /></a> | |
<# } #> | |
<h3><a href="{{{data.link}}}">{{{ data.post_title }}}</a></h1></h3> | |
<p class="entry-meta">{{{ data.date }}}</p> | |
<p>{{{ data.post_excerpt }}}</p> | |
</li> | |
</script> |
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
// Get the data of a block | |
wp.data.select( 'core/block-editor' ).getBlocks()[0] | |
// Update attributes of another block | |
// wp.data.dispatch( 'core/editor' ).updateBlockAttributes( clientID, attributes ) | |
wp.data.dispatch( 'core/block-editor' ).updateBlockAttributes( '10d88a6d-95d6-4e07-8293-5f59c83a26c0', { heading: 'New Heading' } ) | |
// Get currently selected block. | |
wp.data.select( 'core/block-editor' ).getBlockSelectionStart() |
<?php | |
namespace JensSogaard; | |
class BlockHelper | |
{ | |
/** | |
* Gets ACF fields for a specific block on a given post | |
* @author Jens Soegaard <[email protected]> | |
*/ | |
public function getBlockFromPage(string $block_id, int $post_id) |