Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // custom excerpt length
- function themify_custom_excerpt_length( $length ) {
- return 25;
- }
- add_filter( 'excerpt_length', 'themify_custom_excerpt_length', 999 );
- // add more link to excerpt
- function themify_custom_excerpt_more($more) {
- global $post;
- return '<a href="'. get_permalink($post->ID) . '" class="readmore">... read more ></a>';
- }
- add_filter('excerpt_more', 'themify_custom_excerpt_more');
- // Add theme support for post thumbnails
- add_theme_support('post-thumbnails');
- add_image_size( 'custom_thumb', 280, 180, true);
- // Add thumbnail to excerpt
- add_filter( 'excerpt_thumbnail', 'the_excerpt' );
- function excerpt_thumbnail($excerpt){
- if(is_single()) return $excerpt;
- global $post;
- if ( has_post_thumbnail() ) {
- $img .= '<div class="attachment-custom_thumb">'.get_the_post_thumbnail($post->ID, 'custom_thumb').'</div>';
- } else {
- $img = '';
- }
- return $img.$excerpt;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement