Advertisement
Guest User

function.php

a guest
Nov 28th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. // custom excerpt length
  5. function themify_custom_excerpt_length( $length ) {
  6. return 25;
  7. }
  8. add_filter( 'excerpt_length', 'themify_custom_excerpt_length', 999 );
  9.  
  10.  
  11. // add more link to excerpt
  12. function themify_custom_excerpt_more($more) {
  13. global $post;
  14. return '<a href="'. get_permalink($post->ID) . '" class="readmore">... read more ></a>';
  15. }
  16. add_filter('excerpt_more', 'themify_custom_excerpt_more');
  17.  
  18.  
  19.  
  20. // Add theme support for post thumbnails
  21. add_theme_support('post-thumbnails');
  22. add_image_size( 'custom_thumb', 280, 180, true);
  23.  
  24.  
  25.  
  26. // Add thumbnail to excerpt
  27. add_filter( 'excerpt_thumbnail', 'the_excerpt' );
  28. function excerpt_thumbnail($excerpt){
  29. if(is_single()) return $excerpt;
  30. global $post;
  31. if ( has_post_thumbnail() ) {
  32. $img .= '<div class="attachment-custom_thumb">'.get_the_post_thumbnail($post->ID, 'custom_thumb').'</div>';
  33. } else {
  34. $img = '';
  35. }
  36. return $img.$excerpt;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement