Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for gutenberg

February 27, 2021

Disable Gutenberg

Two years ago, WordPress introduced Gutenberg block editor together with the release of WordPress version 5.0. Gutenberg essentially became the default editor starting with WordPress version 5.0. While many people love the Gutenberg editor, some people hate it. If you’re one of the many people who hate the Gutenberg editor, you can simply disable it by installing a plugin called Disable Gutenberg. This plugin will revert back to the classic editor.

Once installed, you should be able to see the Classic editor.

After working with Gutenberg for so long, I forgot the speed and agility of the classic editor. It’s much faster.

January 20, 2019

Gutenberg Youtube Embed

The Gutenberg Youtube embed lacks a few things. The alignment doesn’t seem to be working, at least in the theme I’m using. I’m using Generate-Pro, a Genesis child theme. By default, it’s left-aligned. I have to add this div to make it centered.

<div style="text-align:center">
</div>

<div style="text-align:center"> </div>

If you want right aligned, use this div.

<div style="text-align:right">
</div>

<div style="text-align:right"> </div>

January 1, 2019

Block Lab

Block Lab is a plugin that allows you to create custom blocks within the WordPress Gutenberg editor. You can create blocks for content or code that you repeatedly use in an effort to simplify publishing. To create a custom plugin, you will need to create a block first. Once you named a block, you can add fields to that block and pass the variables to the block templates. The template contains the code that you need to send to the Gutenberg editor in the form of blocks. Here’s an example of a Block and Template.

My Custom Block

Custom block

Template: block-my-custom-block.php

The “block_field” function echoes the variables passed from the blocks to the template.

<h4><?php block_field( 'heading' )?></h4>

<h4><?php block_field( 'heading' )?></h4>

In some instances, you may have to mute the echo. In this example, I’m using the function in a comparison.

<h4><?php if (block_field( 'heading', $echo = false ) == ""):
 else: block_field( 'heading' ); endif; ?></h4>

<h4><?php if (block_field( 'heading', $echo = false ) == ""): else: block_field( 'heading' ); endif; ?></h4>

December 26, 2018

Building A Custom Block

I found a new WordPress plugin that allows you to add custom blocks within the Gutenberg editor. You can create any block that you want by using the same templating code you’re already familiar with in WordPress. You can work with CSS, PHP, plugin shortcodes, etc. It’s a beautiful plugin with endless possibilities. The plugin is called Block Lab.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021