Wordpress: Display Post Titles With a Custom Length


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Add to functions.php:
  2.  
  3. function ODD_title($char) {
  4. $title = get_the_title($post->ID);
  5. $title = substr($title,0,$char);
  6. echo $title;
  7. }
  8.  
  9.  
  10.  
  11. insert into template:
  12.  
  13. <?php ODD_title(20); ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.