Wholesome Code Wholesome Code
Wholesome Code Wholesome Code
  • Blog
  • Guides
  • Plugins
  • About
  • Contact

Hi, Welcome to

Wholesome Code

U.

Using a Template with InnerBlocks in the WordPress Block Editor (Gutenberg)

2 days agoMarch 4, 2021By Matt WatsonIn Guides, WordPress0 Comments23 Views
Using a Template with InnerBlocks in the WordPress Block Editor (Gutenberg)

When you create a block in the WordPress Block Editor (Gutenberg) you can create an area that allows other block types to be nested inside your block. You do this with the InnerBlocks component. In our other guides we previously…

Read more

R.

Register a Block Template for the WordPress Block Editor (Gutenberg)

2 days agoMarch 5, 2021By Matt WatsonIn Guides, WordPress0 Comments52 Views
function register_block_template() { // ... Define $block_template using an array of blocks. $post_type_object = get_post_type_object( 'post' ); $post_type_object->template = $block_template; $post_type_object->template_lock = 'all'; } add_action( 'init', 'register_block_template' );

In my previous guide I explored the power of block patterns. Block templates are similar, but instead of relying on your client to insert block patterns into the editor, it gives them a full layout as soon as they insert…

Read more

R.

Register a Block Pattern in the WordPress Block Editor (Gutenberg)

4 days agoMarch 4, 2021By Matt WatsonIn Guides, WordPress0 Comments68 Views
register_block_pattern( 'wholesomecode/example-block-pattern', [ 'categories' => [ 'my-client', ], 'content' => $block_pattern_content, 'description' => 'An example block pattern', 'keywords' => 'example', 'title' => 'Example Block Pattern', 'viewportWidth' => 800, ], );

Block patterns in the WordPress block editor (Gutenberg) are a powerful feature that let you create varied layouts with very little effort. Using register_block_pattern you can very quickly create a block pattern for you or your clients. You build block…

Read more

C.

Creating a Plugin for the WordPress Block Editor (Gutenberg)

7 days agoMarch 3, 2021By Matt WatsonIn Guides, WordPress0 Comments43 Views
npm init @wordpress/block

If you are new to the WordPress Block Editor (Gutenberg) you may be wondering how to get started with creating your own plugin. Luckily the WordPress development team have a handy npm script for you to create a block plugin…

Read more

I.

Install WordPress Repository Plugins and Themes with Composer

February 21, 2021 11:19 pmFebruary 21, 2021By Matt WatsonIn Guides, WordPress0 Comments169 Views
{ "name": "wholesomecode/composer-example", "description": "Demonstration of how to use composer within WordPress", "require": { "wpackagist-plugin/wholesome-publishing":">=1.3.0" }, "repositories": [ { "type":"composer", "url":"https://wpackagist.org" } ] }

In my last guide I told you how to install your GitHub maintained WordPress themes and plugins with composer. Well what if I told you you could also use composer to install any Theme or Plugin from the WordPress repository?…

Read more

I.

Install WordPress Plugins and Themes from GitHub with Composer

February 18, 2021 10:46 pmMarch 3, 2021By Matt WatsonIn Guides, WordPress0 Comments176 Views
{ "name": "wholesomecode/composer-example-theme", "description": "Demonstration of how to use composer within WordPress", "type": "wordpress-theme", "require": { "composer/installers": "~1.0" } }

In your client projects, do you keep installing the same theme or plugin that you have developed? Do you make a fix in one project that you really wish you could easily roll out to all the other projects? If…

Read more

u.

update_post_meta WordPress Block Editor (Gutenberg) Equivalent is editPost

February 10, 2021 8:54 pmFebruary 10, 2021By Matt WatsonIn Blog, WordPress0 Comments189 Views
wp.data.dispatch( 'core/editor' ).editPost( { meta: { wholesomecode_meta_key_example: 'Example', }, } );

If you are wondering how to update_post_meta on the current post with Gutenberg, this is the article for you. You can just use editPost like so: The code above will update the post meta wholesomecode_meta_key_example with the value ‘Example’. Remember…

Read more

w.

wp_get_attachment_image WordPress Block Editor (Gutenberg) Equivalent is getMeta

February 9, 2021 9:56 pmFebruary 10, 2021By Matt WatsonIn Blog, WordPress0 Comments134 Views
wp.data.select( 'core' ).getMedia( 42 );

Looking for how to get the post thumbnail, or an attachment URL by its Id in WordPress gutenberg? You may have a returned post object by using the WordPress Gutenberg equivalent of WP_Query (or the WordPress Gutenberg equivalent of get_post)….

Read more

g.

get_post_meta WordPress Block Editor (Gutenberg) Equivalent is getEditedPostAttribute(‘meta’)

February 7, 2021 7:39 pmFebruary 10, 2021By Matt WatsonIn Blog, WordPress0 Comments204 Views
const meta = wp.data.select('core/editor').getEditedPostAttribute('meta');

If you are new to writing plugins for the WordPress Block Editor (Gutenberg), you may be searching around for how to get the meta of the current post with get_post_meta. Never fear, you can still get_post_meta, just use getEditedPostAttribute(‘meta’) on…

Read more

W.

WP_Query WordPress Block Editor (Gutenberg) Equivalent is getEntityRecords

February 5, 2021 11:54 pmMarch 3, 2021By Matt WatsonIn Blog, WordPress4 Comments581 Views
wp.data.select( 'core' ).getEntityRecords( 'postType', 'post', { 'status': 'draft', 'per_page': 2, } );

If you are new to writing plugins for the WordPress Block Editor (Gutenberg), you may be a little confused how to do all the things you did regularly, like grabbing posts with WP_Query. You will be very pleased to know…

Read more

Posts navigation

1 2 3 4 5 6 7 Next

Useful Links

  • About
  • Terms and Conditions
  • Privacy Policy
  • Cookie Policy
  • Contact

Guides

  • Using a Template with InnerBlocks in the WordPress Block Editor (Gutenberg)
  • Register a Block Template for the WordPress Block Editor (Gutenberg)
  • Register a Block Pattern in the WordPress Block Editor (Gutenberg)

Latest Posts

  • update_post_meta WordPress Block Editor (Gutenberg) Equivalent is editPost
  • wp_get_attachment_image WordPress Block Editor (Gutenberg) Equivalent is getMeta
  • get_post_meta WordPress Block Editor (Gutenberg) Equivalent is getEditedPostAttribute(‘meta’)
  • WP_Query WordPress Block Editor (Gutenberg) Equivalent is getEntityRecords

About

Wholesome Code: Crafting wonderfully wholesome things with WordPress.

Subscribe

© 2019 – 2021 Wholesome Code Ltd.
All rights reserved | Business No: 12196107

Menu
  • Blog
  • Guides
  • Plugins
  • About
  • Contact
Search
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkPrivacy policy