Advertisement
helgatheviki

Thematic "More" type

Mar 26th, 2011
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. //change where theme uses excerpts
  2. function childtheme_content($content) {
  3.     if (is_home() || is_archive()) {
  4.         $content= 'more';
  5.     }
  6.     return $content;
  7. }
  8. add_filter('thematic_content', 'childtheme_content');
  9.  
  10.  
  11. //change default Thematic excerpts to kia_excerpts
  12. function childtheme_excerpts($post) {
  13.     global $thematic_content_length;
  14.    
  15.         if ( strtolower($thematic_content_length) == 'more' ) {
  16.  
  17.             if ( preg_match('/<!--more(.*?)?-->/', get_the_content() ) ) { 
  18.                 $post = get_the_content(more_text());
  19.                 $post = apply_filters('the_content', $post);
  20.                 $post = str_replace(']]>', ']]&gt;', $post);
  21.                
  22.             } else {
  23.                 $post = '';
  24.                
  25.                     if  ( has_post_thumbnail() ) {
  26.                         $post .= '<a class="entry-thumb" href="' . get_permalink() . '" title="Permalink to ' . get_the_title() . '" >' . get_the_post_thumbnail(get_the_ID(), 'thumbnail', $attr) . '</a>' ;
  27.                     }
  28.  
  29.                     $post .= get_the_excerpt();
  30.                     $post = apply_filters('the_excerpt',$post);                
  31.                    
  32.                     $post .= '<p class="readmore"><a title="'. _('Permalink to ').get_the_title() . '" href=" ' . get_permalink() . '">'._('Read More').'&raquo;</a></p>'; 
  33.                
  34.                 }
  35.                    
  36.  
  37.         }
  38.                        
  39.     return $post;
  40.  
  41. }
  42.  
  43. add_filter('thematic_post', 'childtheme_excerpts');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement