STATUS ÜBERPRÜFEN
I AM LISTENING TO
|

Gutenberg Grids & Timber ++ Some CSS Grid Magic!

5. Juli 2021
.SHARE

Inhaltsverzeichnis

A grid mystery

Somehow the Grids Layout Builder for Gutenberg ist not pushing styles to the footer within a Timber theme. At least not for me.

Somehow the wp_footer action within the Grids plugin is not being executed and no grid styles are added to the footer. I am not getting any errors, but will have to investigate some more in the near future ;) 

Update: It is related to the get_footer action within Grids. get_footer is used to load the appropriate footer template file, which I am not using in my Timber theme ;) So the workaround below is perfect.

Quick patch

Here a quick workaround for the theme functions.php, that does the trick for now.

Grids for WordPress, what is that?

„A layout builder is a tool that helps you creating visual structures in your page, from a simple layout made by adjacent columns, to more complex compositions. 

Grids is entirely based on the WordPress block editor, which means that you’ll be able to use it together with the myriad of content blocks that developers and designers from all around the World are creating. 

With Grids, we’re bringing a visual structure to the content written with the WordPress Block Editor.“ 
Grids: Layout builder for WordPress / Documentation / CSS-Tricks Article / A Complete Guide to Grid

Grids Example

This is using the Grids Plugin and only took a couple of minutes! I am so glad IE 11 is soon completely unsupported ;) and we can start using CSS Grid freely. Well we can, as nobody should be using IE 11 anymore!!! 

On mobile its just stacked rows :)

CSS GRID: SOLVING PUZZLES

COLUMN 1
I love to solve puzzles and find epic solutions :)

CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives.

Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables.

LOVE IT!

COLUMN 2
We all love magazine-style layouts and we are getting closer to getting that :) The magic is in the detail.

For example, a grid container’s child elements could position themselves so they actually overlap another layer, similar to CSS positioned elements.

FLEX OR GRID
The basic difference between CSS Grid Layout and CSS Flexbox Layout is that flexbox was designed for layout in one dimension – either a row or a column.

Grid was designed for two-dimensional layout – rows, and columns at the same time.

COLUMN 3
I only styled the Desktop size, as a little preview. Added Custom CSS to switch areas for tablet sizes.

  • The grid properties are supported in all modern browsers.
  • An HTML element becomes a grid container when its display property is set to grid or inline-grid.
  • All direct children of the grid container automatically become grid items.
  • The spaces between each column/row are called gaps.

STAR TREK IPSUM

Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I’d say the graviton generator is depolarized.

The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.

VS

STAR WARS IPSUM

Lucas ipsum dolor sit amet c-3po solo bothan qui-gon darth solo darth dantooine dagobah mustafar. Fett solo yoda r2-d2 kit obi-wan hutt amidala kenobi. Jade leia gonk lobot ahsoka darth jade skywalker organa. Utapau mara owen darth darth yavin.

Lando baba wedge darth solo skywalker ben fett. Fisto wookiee bothan antilles antilles luke kenobi. Yavin naboo kenobi jinn calamari antilles. Organa jabba skywalker gamorrean ackbar. Windu skywalker kit skywalker. Dantooine dantooine moff leia dantooine wicket amidala.

Things missing!

This is almost a perfect Gutenberg plugin and a reduced / simplified integration of CSS grid. I really think that this plugin makes Gutenberg 1000times better. 

There is so much repetition of Gutenberg blocks out there, while this really addresses something new and nails it :)

There are still things missing, that are critical and would make this even more useful for certain websites:

  1. Allow to name grid areas. Would allow faster manual css modifications. 
  2. Allow grid templates per breakpoint. This would make it perfectly usable in a responsive world. This is by far the most important issue!
  3. Some additional styling options would be nice, but nothing major. (Allow to adjust the grid gap …)
  4. Export the inline styles to files, that would leverage caching far better.
  5. Custom CSS integration, which allows to centralize Custom CSS for areas and sections.


Enjoy coding …

Let’s Talk!

Suchen Sie einen zuverlässigen Partner, der Ihr Projekt auf die nächste Stufe bringt? Ob es sich um Entwicklung, Design, Sicherheit oder laufenden Support handelt – ich würde mich gerne mit Ihnen unterhalten und herausfinden, wie ich Ihnen helfen kann.

Nehmen Sie Kontakt auf,
und lassen Sie uns gemeinsam etwas Erstaunliches schaffen!

RELATED POSTS

„Klaro [klɛro] is a simple consent management platform (CMP) and privacy tool that helps you to be transparent about the third-party applications on your website. It is designed to be extremely simple, intuitive and easy to use while allowing you to be compliant with all relevant regulations (notably GDPR and ePrivacy).“ The tool is developed […]

PHP dotenv loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically. You should never store sensitive credentials in your code. Anything that is likely to change between deployment environments – such as database credentials or credentials for 3rd party services – should be extracted from the code into environment variables. Add your application configuration to a .env file in the root […]

When loading web-fonts, we often see a brief un-styled moment before the browser applies the actual font. Gladly Typekit and also Google Web Fonts provide an option around that. Both are using WebFont Loaders to help handle those brief moments. TypeKit Webfont Loader Example (function(d) { var config = { kitId: ‚***‘ , // Your […]

Alexander

Ich bin ein Full-Stack-Entwickler. Meine Fachkenntnisse umfassen:

  • Server-, Netzwerk- und Hosting-Umgebungen
  • Datenmodellierung / Import / Export
  • Geschäftslogik
  • API-Schicht / Aktionsschicht / MVC
  • Benutzeroberflächen
  • Benutzererfahrung
  • Verstehen, was der Kunde und das Unternehmen brauchen

Ich habe eine große Leidenschaft für das Programmieren, das Design und die Serverarchitektur – jeder dieser Bereiche beflügelt meine Kreativität, und ich würde mich ohne sie nicht vollständig fühlen.

Mit einem breiten Spektrum an Interessen erforsche ich ständig neue Technologien und erweitere mein Wissen, wo immer es nötig ist. Die Welt der Technik entwickelt sich rasant, und ich liebe es, mit den neuesten Innovationen Schritt zu halten.

Jenseits der Technologie schätze ich den Frieden und umgebe mich mit Gleichgesinnten.

Ich glaube fest an das Prinzip: Helfen Sie anderen, und die Hilfe wird zu Ihnen zurückkommen, wenn Sie sie brauchen.