Closed andrei-l-cristea closed 1 month ago
As pune un filtru, sa nu mai adaugam inca onsetare
There is no need to add another filter for this. We have a larger filter where we can modify the description (only on hover, not the caption).
Add one of these functions, for example, in wp-content/themes/
Limits the number of characters at 55 characters. add_filter( 'modula_shortcode_item_data', 'modula_max_length_hover_description', 100 ); function modula_max_length_hover_description( $item_data ) { $max_length = 55; if( isset( $item_data['description'] ) && '' != $item_data['description'] && strlen( $item_data['description'] ) > $max_length ){
$item_data['description'] = substr( $item_data['description'], 0, $max_length );
}
return $item_data; }
Limits number of words at 55 words. add_filter( 'modula_shortcode_item_data', 'modula_max_words_hover_description', 100 ); function modula_max_words_hover_description( $item_data ) { $max_words = 55;
if ( isset( $item_data['description'] ) && '' != $item_data['description'] ) {
$words = explode(' ', $item_data['description']);
if (count($words) > $max_words) {
$item_data['description'] = implode(' ', array_slice($words, 0, $max_words));
}
}
return $item_data; }
Sa poti configura din modula o limita de caractere pentru caption-ul afisat in listarea generala. Cand deschizi o imagine in lightbox sa fie afisat tot caption-ul.