Adding Global Twig Variables

Have you ever had the need to set global variables that can be used across multiple Twig templates? Then you might have tried to create a Twig Template, set a few variables and included that in another template, only to discover that you couldn’t get to those variables because they are scoped to the original…

Read More

Tabs by month

If you want to avoid the clutter of listing all posts as one big list, you might consider grouping them in accordions by month for instance. But how would you be able to do that yourself? You can do that easily in Toolbox using the Timber Posts module! {# let's add 2 variables to keep…

Read More

Adding a masonry grid

A masonry grid is when you have items that are laid out one after the other in the inline direction. When items move onto the next line, they will also move up into any gaps left by shorter items in the first line. Here’s an example: Card Title Officiis odio quisquam? Molestiae… Card Title Officiis…

Read More

Relationship Fields

When creating a WordPress website that makes use of relationships between Custom Post Types, it is key that you can extract the relationships and render the information the way that you want it, not just the way that a 3rd party plugin allows you to. Toolbox gives you the tools to do that very easily.…

Read More

Why I use macros for everything

UIKit needed Make sure to activate the UIkit CSS/JS setting in Toolbox Settings Okay, so I get that this is a pretty spammy title. But Twig macros are just awesome to use all over your templates. They’re like the CSS-classes of HTML. What is a macro? A macro is a re-usable piece of code, sort…

Read More

Using Toolbox to generate shortcodes

Shortcodes aren’t the prettiest thing to use on a WordPress website. And some will go as far as to say that you should avoid them at all cost. But they can also be very useful, are fairly useful to use and above all, they’re pretty safe because users can use them, but don’t need to…

Read More

Twig Conditional Logic for Beaver Themer

Conditional Logic in Beaver Builder is a very handy tool in controlling the display of Beaver Builder nodes, such as rows, columns and modules. There is a whole gamma of conditions that you can add, but in rare cases you may find yourself not finding the exact match that you need. Writing additional conditional rules…

Read More

Twig Blocks to render ACF Flexible Content fields

Flexible Content fields are part of the ACF Pro plugin and boast a lot of power. ACF users have been using them allow users to add content blocks to the layout, without them having to worry about the HTML-code that needs to be generated around them. Before Gutenberg Blocks it was an excellent way of…

Read More

The For Loop and Scope

One of the most common routine in Twig templates is the for .. endfor loop. It is the easiest way to iterate over all instances of an array or object in order to do something with the data. Let’s imagine we have a group of regular posts from the normal posts post-type. A regular loop…

Read More

Twig conditionals

When you use a custom field solution like ACF or Meta Box you will want to output the data that you have entered. But sometimes, conditions apply so that the output changes. Let’s take a post in which we advertise items at a certain price. But for some items, prices change on a daily basis…

Read More