Skip to content
Docs
Get RestroPress

Filter

rpress_{$type}_class

Updated
On this page

Filters the CSS classes of a cart message box.

Runs in rpress_display_cart_messages() for each message stored in the session. The message type is guessed from its text: 'error' if it contains the word error, 'success' if it contains success, otherwise 'info', giving rpress_error_class, rpress_success_class or rpress_info_class. Each class is passed through sanitize_html_class() afterwards.

Parameters#

ParameterTypeDescription
$valuearrayCSS classes for the message box.

Return value#

array. The CSS classes.

Example#

function my_cart_message_classes( $classes ) {
	$classes[] = 'my-cart-message';
	return $classes;
}
add_filter( 'rpress_success_class', 'my_cart_message_classes', 10, 1 );

Notes#

The suffix is one of error, success or info. rpress_error_class is also applied by rpress_print_errors() with different default classes.

Source#

Applied in:

  • includes/cart/template.php (line 332), in rpress_display_cart_messages()

See also#

Was this page helpful?