WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#36640 new enhancement

Customize: get_custom_logo should allow the image tag to be filtered independently

Reported by: achbed Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.5
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

To allow for further customization of the image tag used in the custom logo, I propose adding a get_custom_logo_img filter to get_custom_logo. This will allow for cleaner modification of the a tag content.

This would be useful in optionally adding accessibility on the image and other content within the home link.

Attachments (2)

custom-logo-img_filter.patch (1.0 KB) - added by achbed 21 months ago.
custom-logo-imgattr_filter.patch (1.1 KB) - added by achbed 21 months ago.
Alternate: Filter for the attributes only instead of the entire img tag

Download all attachments as: .zip

Change History (4)

#1 @westonruter
21 months ago

  • Keywords has-patch added
  • Version changed from trunk to 4.5

Giving more control over the generation of the img markup makes sense, but we'd want to make sure that custom-logo-link class is always includes as otherwise the selective refresh selector will fail to match. Well, I suppose we could still allow it to be changed, but the plugin that filters get_custom_logo_img should also make sure it updates $wp_customize->selective_refresh->get_partial( 'custom_logo' )->selector as required. This should be noted in the filter description.

#2 @achbed
21 months ago

I supposed for accessibility and theming purposes, we could simply allow filtering the image tag attributes. We can then enforce the custom-logo-link class after the filter returns.

@achbed
21 months ago

Alternate: Filter for the attributes only instead of the entire img tag

Note: See TracTickets for help on using tickets.