Cover


Add an image or video with a text overlay.

  • Name: core/cover
  • Category: media
  • API Version: 3
  • Block Type: Hybrid (static save + server enhancements)

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
url string Role: content
useFeaturedImage boolean false
id number
alt string ""
hasParallax boolean false
isRepeated boolean false
dimRatio number 100
overlayColor string
customOverlayColor string
isUserOverlayColor boolean
backgroundType string "image"
focalPoint object
minHeight number
minHeightUnit string
gradient string
customGradient string
contentPosition string
isDark boolean true
templateLock string \| boolean Enum: all, insert, contentOnly, false
tagName string "div"
sizeSlug string
poster string Source: attribute. Selector: video. HTML attr: poster

Supports

Defined via the supports property in block.json.

Context

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

Uses context:

  • postId
  • postType

CSS Selectors

Defined via the selectors property in block.json.

  • filter:
    • duotone: .wp-block-cover > .wp-block-cover__image-background, .wp-block-cover > .wp-block-cover__video-background

Block Markup

This is a hybrid block. It saves static markup that the server may enhance during rendering.

<!-- wp:cover {"url":"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=","dimRatio":40} -->
<div class="wp-block-cover">
    <img class="wp-block-cover__image-background" alt="" src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" data-object-fit="cover" />
    <span aria-hidden="true" class="wp-block-cover__background has-background-dim-40 has-background-dim"></span>
    <div class="wp-block-cover__inner-container">
        <!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
        <p class="has-text-align-center has-large-font-size">
            Guten Berg!
        </p>
        <!-- /wp:paragraph -->
    </div>
</div>
<!-- /wp:cover -->

Source