Skip to content

Content Blocks: Shortcodes & Widgets & Nav Menus #585

@westonruter

Description

@westonruter

I recall talking a conversation at some point with @mattheu regarding how shortcodes (as enhanced by shortcake) are a great candidate for the much-mused “content blocks”. I believe in this conversation it was also suggested that widgets (and nav menu items to a limited extent) are just another side of the same coin. I've been wanting to tackle a rewrite of widgets for awhile now to make them JS-driven (#33507). This now has a dependency on adding JSON schema information to widgets to allow their PHP-serialized instance data to be reliably represented as JSON (#35574), and this in-turn now seems to have a dependency on the Fields API which can be used to specify the schema and also dynamically build the form control via JS.

All of this to say, and forgive me if this all been hashed out previously, to me it seems that the Shortcake project has a lot of overlap with Widgets and the Fields API. Shortcodes could even be implemented as widgets, where the shortcode name is an alias for the widget type (class or id_base), and the shortcode attributes can be passed in directly to the_widget as instance data.

I wanted to open an issue to start a conversation and dump some ideas I've had for awhile, if at least to direct me to where I can join an existing conversation.

Some related Trac tickets:

  • #33507: Allow widget controls to be JS-driven
  • #35574: Add REST API JSON schema information to WP_Widget
  • #28580: Speed up customizer by lazy-loading controls and settings as needed
  • #35669: Store widgets in a custom post type instead of options
  • #33473: Shortcodes + Widgets. Unified "component" API (aka Content Blocks)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions