This topic has 6 replies, 3 voices, and was last updated 5 years, 6 months ago ago by Rose Tyler
In past you helped me to shorten the portfolio’s post title and not let it go on two lines. You suggested to me to insert this piece of script in content-portfolio.php
<?php if(etheme_get_option('project_name')): ?>
<?php
$title = get_the_title();
if( strlen( $title ) > 22 ){
$title = substr( $title, 0, 22 ) . '...';
}
?>
Now my question is, is there a way to move this script from content-portfolio.php to style.css? In order to have something like this:
@media only screen and (max-width: 1200px){
/* title is 25 characters */
}
@media only screen and (max-width: 992px){
/* title is 20 characters */
}
@media only screen and (max-width: 768px){
/* title is 15 characters */
}
Thanks
Hello,
1) That code is not the script, it’s PHP code.
2) You can’t use PHP code in the CSS file. CSS file accepts only CSS code.
Regards
Thanks for the quick response. I understood the difference.
Isn’t there a way to make the PHP code communicate with the CSS code?
Do you say it’s impossible to get what I asked for earlier?
Hello,
There is no way to limit word by N characters using CSS.
Regards
I solved, thanks!
Hello,
You’re welcome!
Have a nice day.
Regards
You must be logged in to reply to this topic.Log in/Sign up