Last update: February 10, 2021

How to style the terms in a WP-Grid-Builder grid

Here is a little tip to set a different color for each term in a grid made with the plugin WP Grid Builder (aff link).

There are 2 different ways, as there are 2 methods to build a grid with WP Grid Builder.

With a card made with WP Grid Builder

Method 1

The easiest and fastest way. We just have to enable the Term Colors option:

Then we go to the category settings and we can have a different color for each category :

Method 2

We can do it with some custom CSS, which mean we can not only change the color but also the weight, font and so on.

If we check the code, we will see a data attribute "data-id" , with a unique number for each different term :

We can now style each term by using this data attribute in CSS :

#shortcode-8-1004 .wp-grid-builder .wpgb-block-term[data-id="5"] {
    color:#FFA752
}
#shortcode-8-1004 .wp-grid-builder .wpgb-block-term[data-id="6"] {
    color:#7652FF
}

It's what you can see in the OXYGEN4FUN homepage.

With a grid made with the Repeater

If you use the Repeater element to build your grid, it's easier as there is no custom CSS to add.

Instead of adding the category only one time, we add them several time (OXYGEN4FUN has 3 categories, so I add them 3 times).

Each category has his own color:

And for each of them, we set a different condition.

It's what you can see here :

category
  • All
  • Tutorials (69)
  • Tips (12)
  • Resources (6)

How to create your own Animated Headings animation with GSAP

Tutorials

How to animate a text along a path

Tutorials

How to add some reveal animations to your elements

Tutorials

How to add a Lightbox to the Gutenberg Gallery Block

Tutorials

How to create a justified gallery

Tutorials

How to animate a Grid that uses the facet from WP-Grid-Builder

Tutorials

Tips for the Composite Elements

Tips

How to use GSAP with Flickity and other sliders

Tutorials

Don't forget to check this tutorial if you want to learn more about how to use this plugin with Oxygen.

closealign-justifychevron-downcaret-up