Advertisement
niammuddin

fungsi excerpt artikel

Jul 27th, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?php
  2. //fungsi excerpt artikel
  3. function excerpt($limit) {
  4. $excerpt = explode(' ', get_the_excerpt(), $limit);
  5. if (count($excerpt)>=$limit) {
  6. array_pop($excerpt);
  7. $excerpt = implode(" ",$excerpt).'...';
  8. } else {
  9. $excerpt = implode(" ",$excerpt);
  10. }
  11. $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
  12. return $excerpt;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement