Master Etch with tutorials, tips, and tricks.

Search

Recent articles

Use .keys() to Check Available Dynamic Data Keys

  • ACF
  • Etch Basics
  • Meta Box
Official documentation: Basic Modifiers

Scenario: You find yourself opening and closing the loop browser to check the available keys you can use, and you think to yourself, “There has to be an easier way.” There is — the .keys() modifier.

The .keys() gives you a faster way to do the same thing directly in your loop/template, especially when you want to inspect a specific nested object without scanning through the full JSON tree.

The syntax is basic — object.keys()

{this.keys()}
{this.acf.keys()}
{item.metabox.keys()}

Just use the modifier with any object, at the root level or on a nested object. Here are a couple of examples:

Image 2
Item Keys
Image 3
Meta Box Keys

Share Your Thoughts

Your email address will not be published. Required fields are marked *