Limit a string using substr to 30 characters.
-
Hey, I’m trying to use the following to limit my post topics to 30 characters, but it doesn’t see to work with the function that retrieves the data.
<?php
$post-string = the_title();
substr($post-string, 0, 30);
?>Does anyone know how to do this? I would like it to appear like the following:
“This is a post topic exam…”
“Here is another post that…” // Cuts off after so many characters and puts three dots.Thanks in advance to any advice!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Limit a string using substr to 30 characters.’ is closed to new replies.