SHOW:
|
|
- or go back to the newest paste.
| 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().'&h=150&w=150&zc=1&q=99&a=t" alt='.$title.' /></a>' ; echo contentnoimg(50); } else{ echo contentnoimg(50);}?><p></p>
| |
| 4 | ||
| 5 | - | <!-- And this is from functions.php: --> |
| 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(']]>', ']]>', $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(']]>', ']]>', $content);
| |
| 34 | - | } |
| 34 | + | |
| 35 | } | |
| 36 | ?> |