跳转到主要内容

Playlist track


Playlist track.

  • Name: core/playlist-track
  • Category: media
  • API Version: 3
  • Block Type: Dynamic (server-rendered)
  • Keywords: music, sound

Block Relationships

Parent blocks (direct):
– core/playlist

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
blob string — Role: local
id number — Role: content
src string — Role: content
type string "audio" —
album string — Role: content
artist string — Role: content
image string — Role: content
imageAlt string — Role: content
length string — Role: content
title string — Role: content

Supports

Defined via the supports property in block.json.

Context

Defined via the usesContext and providesContext properties in block.json.

Uses context:

  • showArtists
  • showImages

Block Markup

This is a dynamic block. It is rendered on the server and does not save HTML in post content.

In post content, it is stored as a block comment:

<!-- wp:core/playlist-track {"id":123,"src":"https://example.com/audio.mp3","album":"Example album","artist":"Example creator","image":"https://example.com/track-image.jpg","imageAlt":"Track image","length":"3:21","title":"Sample track"} /-->

Source