I am styling a WordPress Theme and I would like to make sure that if the post title is longer than 60 characters it shows the first 6ß0 characters + three points (...) at the end
In Native Php would like:
<?php
if (strlen($title) <= 60) {
echo %title
} else {
echo (substr($title, 60) . "..."
}
?>
My problem is that inside WordPress the syntax of variables is not $title but %title as you could see in the code:
<?php previous_post_link( '%link', '%title ' ); ?>
My questions are:
- How would be the final IF inside WordPress
- How would be in shorthand if/else (ternary) form?
Thanks
Aucun commentaire:
Enregistrer un commentaire