Hello. I am using the following script to trim the header:
add_filter(
'hivepress/v1/models/listing/fields',
function($fields, $model){
$fields['title']['max_length'] = 70;
return $fields;
},
1000,
2
);
I need to display for example no more than 25 characters in the title of the ad. The rest of the characters should be hidden with css.
I have written the following css code:
.size {
white-space: nowrap;
overflow: hidden;
padding: 5px;
background: #fc0;
position: relative;
}
.size::after {
content: '';
position: absolute;
right: 0; top: 0;
width: 40px;
height: 100%;
background: -moz-linear-gradient(left, rgba(255,204,0, 0.2), #fc0 100%);
background: -webkit-linear-gradient(left, rgba(255,204,0, 0.2), #fc0 100%);
background: -o-linear-gradient(left, rgba(255,204,0, 0.2), #fc0 100%);
background: -ms-linear-gradient(left, rgba(255,204,0, 0.2), #fc0 100%);
background: linear-gradient(to right, rgba(255,204,0, 0.2), #fc0 100%);
}
How do I assign this code to the title of the ad?
In case anyone didn’t realize, it’s something like this: How to Truncate Text with CSS and JavaScript