Skip to content

Hooks—Media Backgrounds

Jo Dickson edited this page Oct 20, 2021 · 2 revisions

Navigation

Filters


ucfwp_get_media_background_picture_srcs

Returns an array of srcs for a media background picture's inner <source>s by breakpoint.

Parameters

  • $bg_images array

    Associative array of size names and their respective image urls. Expected format:

    array(
        'xs' => '',
        'sm' => '',
        'md' => '',
        'lg' => '',
        'xl' => '',
        'fallback' => ''
    )

    The unique key 'fallback' is used in the theme as the fallback <img> src within the generated <picture> element for browsers that don't support the <picture> tag. $bg_images['fallback'] is required for the theme to generate a media background picture.

Return

array: Associative array of size names and their respective image urls.


ucfwp_media_background_picture_object_position

Allows the object-position property of media background pictures generated by the theme to be adjusted.

NOTE: this hook helps make the necessary data attribute markup changes within media background pictures to support custom object-positioning, but child themes must also provide a style override to .media-background to completely apply their desired changes. See the Athena Framework documentation on media background object-positioning for more info.

Parameters

Return

string: A valid object-position value.


ucfwp_media_background_video_object_position

Allows the object-position property of media background videos generated by the theme to be adjusted.

NOTE: this hook helps make the necessary data attribute markup changes within media background videos to support custom object-positioning, but child themes must also provide a style override to .media-background-video to completely apply their desired changes. See the Athena Framework documentation on media background object-positioning for more info.

Parameters

Return

string: A valid object-position value.


ucfwp_media_background_video_viewport_min_width

Allows adjustment of the minimum screen size at which media background videos should be loaded.

NOTE: by default, this theme disables loading of background videos at Athena's -xs breakpoint (below 576px wide). While this option is available for flexibility, we don't recommend changing this value for performance reasons.

Parameters

  • $width int

    A minimum browser viewport width, in pixels, that media background videos should be loaded in.

Return

int: Viewport width, in pixels

Clone this wiki locally