Advertisement
utnalove

Untitled

Aug 19th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php if ( has_post_thumbnail() ) {
  2. the_post_thumbnail( 'thumbnail', array('class'=>'alignleft', 'alt' => get_the_title() , 'title' => get_the_title() ));
  3. echo contentnoimg(50);} elseif (get_post_image(TRUE))  { echo '<a href='.$link.'><img class="alignleft" src='.$blogurl.'/thumbnail.php?src='.get_post_image().'&amp;h=150&amp;w=150&amp;zc=1&amp;q=99&amp;a=t"  alt='.$title.' /></a>'  ; echo contentnoimg(50); } else{ echo contentnoimg(50);}?><p></p>
  4.  
  5. And this is from functions.php:
  6.  
  7. function content($limit) {
  8.      global $post;
  9.       $content = explode(' ', get_the_content(), $limit);
  10.       if (count($content)>=$limit) {
  11.         array_pop($content);
  12.         $content = implode(" ",$content).'...<a href="'. get_permalink($post->ID) . '">'.__('Read full post','language') .'</a>';
  13.       } else {
  14.         $content = implode(" ",$content);
  15.       }
  16.       $content = preg_replace('/\[.+\]/','', $content);
  17.       $content = apply_filters('the_content', $content);
  18.       $content = str_replace(']]>', ']]&gt;', $content);
  19.       return $content;
  20.     }
  21. function contentnoimg($limit) {
  22.      global $post;
  23.       $content = explode(' ', get_the_content(), $limit);
  24.       if (count($content)>=$limit) {
  25.         array_pop($content);
  26.         $content = implode(" ",$content).'...<a href="'. get_permalink($post->ID) . '">'.__('Read full post','language') .'</a>';
  27.       } else {
  28.         $content = implode(" ",$content);
  29.       }  
  30.       $content = preg_replace('/(<img.+?>)/','', $content);
  31.       $content = apply_filters('the_content', $content);
  32.       $content = str_replace(']]>', ']]&gt;', $content);
  33.       return $content;
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement