add_cssclass() WordPress Function
The add_cssclass() function allows you to add a custom CSS class to any Wordpress element. This is useful for customizing the look and feel of your site without having to edit the theme's CSS file. To use this function, simply add the following code to your theme's functions.php file:
add_cssclass( string $class_to_add, string $classes ) #
Adds a CSS class to a string.
Parameters
- $class_to_add
(string)(Required)The CSS class to add.
- $classes
(string)(Required)The string to add the CSS class to.
Return
(string) The string with the CSS class added.
Source
File: wp-admin/includes/menu.php
function add_cssclass( $class_to_add, $classes ) { if ( empty( $classes ) ) { return $class_to_add; } return $classes . ' ' . $class_to_add; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |