Adds a CSS class to a string.
Parameters
$class_to_add
stringrequired- The CSS class to add.
$classes
stringrequired- The string to add the CSS class to.
Source
function add_cssclass( $class_to_add, $classes ) {
if ( empty( $classes ) ) {
return $class_to_add;
}
return $classes . ' ' . $class_to_add;
}
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
Usage when working over menus order
While the function name does suggest no limitation on its availability, it is defined in
wp-admin/includes/menu.php
, so is not immediately available on the frontend (and use on the frontend is probably discouraged).