Shorten Length of Title for a List of Posts
-
I am trying to shorten the title of the posts displayed given in a list when calling the following function inside of WordPress:
<ul> <?php global $post; $tmp_post = $post; $myposts = get_posts('numberposts=5&offset=1&category=12'); foreach($myposts as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> <?php $post = $tmp_post; ?> </ul>
Basically, if you go to Mashable.com, scroll down the page, and the grey box that has technology, entertainment, web dev, etc… it displays the top posts with …’s after the titles. How are they able to shorten the title?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Shorten Length of Title for a List of Posts’ is closed to new replies.