Opened 21 months ago
Last modified 21 months ago
#57420 new enhancement
Add filter for wp_theme_get_element_class_name
Reported by: | benjgrolleau | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | |
Component: | Editor | Keywords: | has-patch |
Focuses: | Cc: |
Description
Hello,
I think it would be a good idea to add a filter to the wp_theme_get_element_class_name or WP_Theme_JSON::get_element_class_name function return. This would allow to add classes programmatically to the elements.
It could be something like that :
<?php public static function get_element_class_name( $element ) { $class_name = ''; if ( array_key_exists( $element, static::__EXPERIMENTAL_ELEMENT_CLASS_NAMES ) ) { $class_name = static::__EXPERIMENTAL_ELEMENT_CLASS_NAMES[ $element ]; } return apply_filters( "element_{$element}class_name", $class_name ); // Or another option, without dynamic part. return apply_filters( "element_class_name", $class_name, $element ); }
Have a nice day.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
I've made a mistake, there's a missing underscore the filter could be :