Advanced Views Docs
Live PlaygroundDownload PluginGet PRO
  • 💡Help Centre
  • ⚡Getting Started
    • Introduction
      • Key Aspects
      • Creating Your First View
      • Creating Your First Card
      • Plugin Terms
      • Plugin Interface
        • Field Options
    • Installation
      • Advanced Views Lite
      • Advanced Views Pro
      • Comparison Table
      • Upgrading from Lite to Pro
    • Supported data vendors
    • Starter theme
  • 🌟Display Content
    • WordPress
      • Post
      • Taxonomy terms
      • User
      • Comments
      • Menus
    • WooCommerce Product
    • Meta fields
      • Basic fields
        • Number
      • Content fields
        • Image
        • File
        • WYSIWYG
        • oEmbed
        • Gallery
      • Choice fields
        • Select/checkbox/radio
        • True / False
      • Relationship fields
        • Link
        • Post_object
        • Page Link
        • Relationship
        • Taxonomy
        • User
      • Advanced fields
        • Google Map
        • Google Map Multiple Markers
        • ACF OpenStreetMap Field
        • Date/time picker
      • Layout fields
        • Group (Pro)
        • Repeater (Pro)
        • Flexible (Pro)
    • Object fields
    • Custom Data (Pro)
    • Custom Gutenberg Blocks (Pro)
    • Mount Points (Pro)
    • Front-end assets management (Pro)
  • 🦸‍♂️Query Content
    • Basic Filters
    • Meta Filters (Pro)
      • Current Post
      • Comparison
      • Dynamic Injection
    • Taxonomy Filters (Pro)
    • Pagination (Pro)
    • Custom Data (Pro)
  • 🏆Shortcode Attributes
    • Common Arguments
    • View Shortcode
    • Card Shortcode
  • 🧙‍♂️Templates
    • Customizing the Template
    • Template engines
      • Twig
      • Blade
    • CSS & JS
      • BEM Methodology
      • WordPress Interactivity API
    • File system storage
    • Pre-built components
    • Reusable components library (Pro)
    • Live reload
    • Multilingual
    • Custom Ajax & Rest API (Pro)
  • ☕Guides
    • Display Custom Post Type (CPT) on another post
    • Display Employees (CPT) of a Company (CPT)
    • Display Nested Repeater Fields
    • Map Marker from ACF Image
    • Display all CPT items on a single map
  • 🛠️Tools
    • Export/Import
    • Demo Import
    • Settings
    • Preview
  • 🏹Troubleshooting
    • Compatibility
    • Report a bug
    • Payment Issues
    • Lite Support (Forum)
    • Pro Support
  • ⚙️Customization
    • Filters and Hooks
      • View
      • Card
    • Suggest a feature
    • Performance
Powered by GitBook
On this page
  • Benefits
  • How it works
  • How to use it
  • See it in action

Was this helpful?

  1. Display Content

Custom Gutenberg Blocks (Pro)

PreviousCustom Data (Pro)NextMount Points (Pro)

Last updated 1 month ago

Was this helpful?

Benefits

While the Gutenberg editor provides enhanced flexibility, it lacks a proper PHP API for creating blocks with fields.

Advanced Views Pro supports , and features, so if they're available, you can transform any View into a Gutenberg block without the need for .

We recommend using this method on pages that support Gutenberg for the following reasons:

  1. Improved performance Block data is stored within the current Post content and does not trigger additional meta queries, resulting in better performance.

  2. Reusability Unlike meta field groups, blocks can be used multiple times on the same page, enhancing reusability.

How it works

Every View, by default, contains all the necessary info for block creation: chosen fields and display template. When you enable the Gutenberg block option, Advanced Views automatically:

  1. Creates a new Gutenberg block using the , or feature

  2. [For ACF]: Clones all the chosen ACF fields and creates a new private ACF Group with them. Sets up the group location to the Gutenberg block created in the first step.

  3. [For MetaBox]: Clones all the chosen MB fields and creates a new MB Group with the Block setting

  4. [For Pods]: Clones all the chosen Pods fields and attaches to the Gutenberg block created in the first step

Then, when you paste the new Gutenberg block and visit the page, the block is rendering, and block vendor plugin (ACF, MetaBox or Pods) calls our plugin's callback. Our plugin passes data from the Gutenberg block into the View template and prints the rendered markup on the page.

All the above happens in the background, which means creation a custom Gutenberg block doesn't require extra efforts from you.

Note: Advanced Views Pro extends the Blocks feature of your meta fields vendor.

It means in order to use the Custom Gutenberg block feature for Views you must have:

Please keep in mind, that vendor of the Blocks feature must fit the meta fields vendor. For example, you can't use the MB Blocks vendor for ACF fields and visa versa.

How to use it

Go to Edit your View.

In the Options tab, switch on the With Gutenberg Block checkbox.

Click Update to save your View.

Edit your Post, Page or CPT item using the Gutenberg editor.

Insert a new block, selecting your View’s block from the list. It’ll have your View name as the block name.

Fill the fields in the block you’ve just inserted.

Click on Publish to save your post, page or CPT item.

Visit the page to see the result.

Note: It’s important to use the Gutenberg editor and not the Classic editor or page builder element, as the block generated is only available in the Gutenberg blocks library.

See it in action

an active (if you use ACF fields in your View)

an active addon (if you use MetaBox fields in your View)

an active plugin (for Pods fields; the feature is built-in into the free Pods plugin)

If you're using Pods, bear in mind that Pods Blocks have limited support for field types. Check the supported field types on the .

and Turn any View or Card into a Gutenberg block then add it to a page.

🌟
ACF Blocks
MB Blocks
Pods Blocks
React knowledge
ACF Blocks
MB Blocks
Pods Blocks
ACF Pro
MB Blocks
Pods
official feature page
Visit the Playground