Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Backport] Add wp_theme_element_class_name() alias
  • Loading branch information
ockham committed Sep 14, 2022
commit e8f521066e732f62e240a55690f844003a1beb0a
14 changes: 14 additions & 0 deletions src/wp-includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -4203,6 +4203,20 @@ function wp_is_block_theme() {
return wp_get_theme()->is_block_theme();
}

/**
* Given an element name, returns a class name.
* Alias from WP_Theme_JSON::get_element_class_name.
*
* @param string $element The name of the element.
*
* @return string The name of the class.
*
* @since 6.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: @param and @return should come after @since.

*/
function wp_theme_element_class_name( $element ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the original method, and for consistent use of the active verb, I'd suggest renaming this alias to wp_theme_get_element_class_name(). 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! That does have a nicer ring to it 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return WP_Theme_JSON::get_element_class_name( $element );
}

/**
* Adds default theme supports for block themes when the 'setup_theme' action fires.
*
Expand Down