Advertisement
utnalove

functions.php

Aug 19th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. function content($limit) {
  2.      global $post;
  3.       $content = explode(' ', get_the_content(), $limit);
  4.       if (count($content)>=$limit) {
  5.         array_pop($content);
  6.         $content = implode(" ",$content);
  7. $content = force_balance_tags($content);
  8. $content .= '...<a href="'. get_permalink($post->ID) . '">'.__('Read full post','language') .'</a>';
  9.       } else {
  10.         $content = implode(" ",$content);
  11.       }
  12.       $content = preg_replace('/\[.+\]/','', $content);
  13.       $content = apply_filters('the_content', $content);
  14.       $content = str_replace(']]>', ']]&gt;', $content);
  15.       return $content;
  16.     }
  17. function contentnoimg($limit) {
  18.      global $post;
  19.       $content = explode(' ', get_the_content(), $limit);
  20.       if (count($content)>=$limit) {
  21.         array_pop($content);
  22.         $content = implode(" ",$content).'...<a href="'. get_permalink($post->ID) . '">'.__('Read full post','language') .'</a>';
  23.       } else {
  24.         $content = implode(" ",$content);
  25.       }  
  26.       $content = preg_replace('/(<img.+?>)/','', $content);
  27.       $content = apply_filters('the_content', $content);
  28.       $content = str_replace(']]>', ']]&gt;', $content);
  29.       return $content;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement