?> " alt="" width="180" height="180" />"><img src="<?php echo $image['src']; ?> " alt="" width="54" height="54" /></a></td> <td class="text"> <p class="title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></p> <p class="description"><?php if (isset($content[2]) && $content[2]) { echo WordLimiter(strip_tags($content[2])); } else { the_excerpt(); } ?> </p> </td> <td class="menu-price"><p><?php echo $boderaux_currency . $price; ?> </p></td> </tr> </table> <?php } } else {
<?php function WordLimiter($text, $limit = 20) { $explode = explode(' ', $text); $string = ''; $dots = '...'; if (count($explode) <= $limit) { $dots = ''; } for ($i = 0; $i < $limit; $i++) { $string .= $explode[$i] . " "; } if ($dots) { $string = substr($string, 0, strlen($string)); } return $string . $dots; } $text = "Hello this is a list of words that is too long"; echo '1: ' . WordLimiter($text); $text = "Hello this is a list of words"; echo '2: ' . WordLimiter($text);