Can I integrate Gutenberg on one page only?
Can I integrate Gutenberg on one page only?
Can I integrate Gutenberg on one page only?
I finally found it out. You can access current comment settings by using wp.data.select(‘core/editor’).getEditedPostAttribute(‘comment_status’) So the complete solution is: function isCommentsEnabledInBlockEditor() { return wp.data.select(‘core/editor’).getEditedPostAttribute(‘comment_status’) === ‘open’; } function registerPublishBtnHandler() { const publishBtnArray = document.getElementsByClassName(“editor-post-publish-button__button”); if (publishBtnArray && publishBtnArray.length > 0) { const publishBtn = publishBtnArray[0]; if (publishBtn) { publishBtn.addEventListener(“click”, function (e) { if (!isCommentsEnabledInBlockEditor()) { … Read more
WP Scripts provides no such feature for automating this, and if it did automate this it could cause problems. The version in block.json is not the version of your plugin, it’s the version of the block, and doesn’t have to match. Most people are unaware a version parameter even exists. Likewise if you update your … Read more
This isn’t how the WordPress components are supposed to be used. The components from @wordpress/components are meant for use in the admin, typically for creating a UI in the block editor. See how the package is described in the documentation (emphasis mine): This package includes a library of generic WordPress components to be used for … Read more
There’s no direct way to apply a custom class to a portion of text within a paragraph block without tweaking the HTML. The ‘highlight‘ feature you mentioned is close, but it doesn’t let you specify a custom class. To add a custom class, you need to edit the HTML and manually add a custom class. … Read more
Now I can’t replace these with InnerBlocks as Innerblocks can only be used once in a block A HTML tag has this same restriction yet it hasn’t stopped this from being done, the answer is composition. The core/columns block has this same problem and solves it by only allowing individual core/column blocks as its children, … Read more
Thanks for MVE, @helgatheviking! It was beneficial. When wp.data caches the resolvers, it also considers arguments. Here’s what happens when following the reproduction steps for the bug: Selecting the first product resolves data, creates a cache for getProduct(1), and sets a value for the product state. Selecting second does the same (cache: getProduct(2)) and sets … Read more
All the items under your “What I want” list can be easily achieved using the Posts List block which is a variation of the Query Loop block, and if you want to, you can create your very own variation – see Extending the Query Loop block in the block editor handbook. You can check the … Read more
It is now very hidden in the right hand side for the selected nav. Thanks WP team! I will use an example of editing your header with the nav(s) blocks – I have 2, one for desktop and one for mobile this example from the WP team Selected the omni un-namable “Navigation” block (again nice … Read more
wp_add_inline_script can be used to insert a tiny trigger script that executes after the script specified in script and any instance defined by that script will be available. // When this js executes `Masonry` is sure to be defined wp_add_inline_script( ‘masonry’, ‘if (window.top !== window) doItNow()’); This will end up being executed twice when the … Read more