Friday 1 December 2017

Supporting Gutenberg’s “Align wide and full classes” right now


With Gutenberg getting closer and closer to being ready for merge into core WP, I thought it’d be time to look at two of my favorite features being introduced for users and theme developers. That’s the .alignwide and .alignfull classes.
These are two classes that I’ve wished we had for ages. I’ve seen some theme authors implement them in the past, but there was no standard naming scheme for them. Therefore, they couldn’t be shared across themes. Regardless of the direction of the Gutenberg plugin, these two classes are more than welcome.
In this tutorial, I’m going to cover adding support for and styling these new classes. I’m already making liberal use of the classes on this site without actually having Gutenberg installed. This is useful with or without the plugin.
While the primary use case in Gutenberg covers images, I’m using the feature for other things too, such as full-width testimonials on my product pages and elsewhere.
Adding Gutenberg support
Adding support for wide and full images is pretty simple. You need to drop the following code into your theme setup function, which should be hooked to after_setup_theme:
add_theme_support(
Source: https://managewp.org/articles/16734/supporting-gutenberg-s-align-wide-and-full-classes-right-now




source https://williechiu40.wordpress.com/2017/12/01/supporting-gutenbergs-align-wide-and-full-classes-right-now/

No comments:

Post a Comment