#36640 closed enhancement (fixed)
Customize: get_custom_logo should allow the image tag to be filtered independently
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | 4.5 |
Component: | Customize | Keywords: | has-patch has-dev-note |
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 (3)
Change History (20)
#2
@
8 years 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.
#3
@
4 years ago
- Milestone set to 5.4
[45028] removed itemprop
from the default custom logo attributes. The get_custom_logo
and wp_get_attachment_image_attributes
filters were suggested as options for restoring itemprop
, and while those certainly work, the filter suggested here would arguably make the process a little less cumbersome.
36640.diff refreshes the previous patch with a couple changes:
- Rename the filter to
get_custom_logo_image_attributes
for consistency withwp_get_attachment_image_attributes
.
- Move the attachment ID to the second filter parameter under the assumption that it'll be more common to need that ID than the current blog ID.
As highlighted in comment:2, the custom-logo-link
class should still be unaffected by the filter.
I'll check in with #core-themes for other opinions, and maybe there can be a yea or nay on this enhancement during the 5.4 cycle.
This ticket was mentioned in Slack in #core-themes by dlh. View the logs.
4 years ago
#6
@
4 years ago
The description says
This will allow for cleaner modification of the
a
tag content.
...other content within the home link
So why is the filter on the image attributes?
#7
@
4 years ago
Filtering the image attributes was suggested by the reporter in comment:2 as a simpler approach to apply the modifications they were looking for.
The title, description, and comment:1 also referenced the image tag specifically, so I took it to be the focus of the request, but perhaps that was mistaken.
For the itemprop
example, at least, being able to modify the attributes array seems to me like it would be simpler than modifying the HTML content within the <a>
.
#8
@
4 years ago
@dlh Do you feel this is still a good candidate for 5.4 with Beta 1 in the next few days?
#9
@
4 years ago
@davidbaumwald Yep, I do still think that it would be good to make a decision on this for 5.4.
#10
@
4 years ago
- Milestone changed from 5.4 to Future Release
This ticket still needs feedback and a review, and with 5.4 Beta 1 landing in a few hours, this is being moved to Future Release
. If any maintainer or committer feels this can be included in 5.4 or wishes to assume ownership during a specific cycle, feel free to update the milestone accordingly.
#11
@
4 years ago
- Milestone changed from Future Release to 5.5
Let's give this one more try for 5.5.
#12
@
3 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 48057:
#13
@
3 years ago
I included some information and possible examples of the new filter in this draft dev note. If you have a better example or other input, please let me know.
#16
follow-up:
↓ 17
@
3 years ago
@SergeyBiryukov should this be punted from 5.5 due to the concerns raised here?
#17
in reply to:
↑ 16
@
3 years ago
- Keywords dev-feedback removed
Replying to johnstonphilip:
should this be punted from 5.5 due to the concerns raised here?
This ticket is just about the get_custom_logo_image_attributes
filter added in [48057].
I think the concerns are related to #37011. Reopening that one to see if that's something to address for 5.5 RC2.
Giving more control over the generation of the
img
markup makes sense, but we'd want to make sure thatcustom-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 filtersget_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.