Easily display post titles with a custom length
February 17th, 2011 at 12:16am Jason 59 views
The first thing to do is to create the function. Open your functions.php file and paste this code:
function ODD_title($char) { $title = get_the_title($post->ID); $title = substr($title,0,$char); echo $title; }
Now, you can use the function on your theme files. Just pass how many characters you want to display as a parameter. In the following exemple, only the first 20 chars of the title will be displayed:
<?php ODD_title(20); ?>
via: http://www.wprecipes.com/easily-display-post-titles-with-a-custom-length
Entry Filed under: WordPress Tagged with: wordpress
Hot Posts Hot Comments Hot Tags
- apartment bbpress blog class CMS code CSS div dream english friends girl Google hot Hot Dog html job JS life lines love Madonna menu Michael Jackson movie oral english PHP plugin saying school sexy site student students submenu success tags teacher teaching txt university video website widget wordpress





Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">
Trackback this post | Subscribe to the comments via RSS Feed