Advertisement
utnalove

Untitled

Aug 19th, 2012
81
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. <?php
  8. function content($limit) {
  9.      global $post;
  10.       $content = explode(' ', get_the_content(), $limit);
  11.       if (count($content)>=$limit) {
  12.         array_pop($content);
  13.         $content = implode(" ",$content).'...<a href="'. get_permalink($post->ID) . '">'.__('Read full post','language') .'</a>';
  14.       } else {
  15.         $content = implode(" ",$content);
  16.       }
  17.       $content = preg_replace('/\[.+\]/','', $content);
  18.       $content = apply_filters('the_content', $content);
  19.       $content = str_replace(']]>', ']]&gt;', $content);
  20.       return $content;
  21.     }
  22. function contentnoimg($limit) {
  23.      global $post;
  24.       $content = explode(' ', get_the_content(), $limit);
  25.       if (count($content)>=$limit) {
  26.         array_pop($content);
  27.         $content = implode(" ",$content).'...<a href="'. get_permalink($post->ID) . '">'.__('Read full post','language') .'</a>';
  28.       } else {
  29.         $content = implode(" ",$content);
  30.       }  
  31.       $content = preg_replace('/(<img.+?>)/','', $content);
  32.       $content = apply_filters('the_content', $content);
  33.       $content = str_replace(']]>', ']]&gt;', $content);
  34.       return $content;
  35.     }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement