Limit znaków w tytule wpisu ?twarda spacja
-
Cze??,
Wtyczka bardzo, bardzo pomocna, ale mam problem i nie mam poj?cia jak go przeskoczy?. Mianowicie, czy istnieje sposób, aby wykluczy? z renderowania tward? spacj? w sytuacji ?amania tytu?u? Co mam dok?adnie na my?li przedstawia obrazek.
HTML przedstawia si? tak:
<h1>Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a&nb...</h1>
PHP:
<h1><?php the_title_limit('', '...', true, '70') ?></h1>
Funkcja:
function the_title_limit($before = '', $after = '', $echo = true, $length = false) { $title = get_the_title(); if ($length && is_numeric($length)) { $title = substr($title, 0, $length); } if (strlen($title) > 0) { $title = apply_filters('the_title_limit', $before . $title . $after, $before, $after); if ($echo) echo $title; else return $title; } }
Pozdrawiam
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Limit znaków w tytule wpisu ?twarda spacja’ is closed to new replies.