Switching php character limit for responsive media queries
I have a responsive site that has php character limits on certain blocks
of text. The limit varies depending whether it's desktop, tablet or mobile
but I'm struggling to switch this limit depending on the device/size.
This is the php code I'm using to limit the text:
<?php ob_start();
the_content();
$old_content = ob_get_clean();
$new_content = strip_tags($old_content);
if(strlen($new_content) > 400){
echo substr($new_content,0,400) . "...";
}else{
echo substr($new_content,0,400);
} ?>
How can I switch this limit in relation to the media queries that make the
site responsive? As far as I know it can't be done with css can it?
No comments:
Post a Comment