Solving the widow problem on your Drupal website Titles


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

Anywhere, the variable $title is printed in a template file, it can be wrapped in this function:

YOURTHEME_widont($title)


Copy this code and paste it in your HTML
  1. function YOURTHEME_widont($str = '') {
  2. $str = rtrim($str);
  3. $space = strrpos($str, ' ');
  4. if ($space !== false) {
  5. $str = substr($str, 0, $space).' '.substr($str, $space + 1);
  6. }
  7. return $str;
  8. }

URL: http://club-sandru.ro/blog/solving_the_widow_problem_on_your_drupal_website.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.