Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottwyden/fc8496b68cabf1884dd5 to your computer and use it in GitHub Desktop.
Save scottwyden/fc8496b68cabf1884dd5 to your computer and use it in GitHub Desktop.
For CSS
.attachment-thumbnail {
float: left;
padding: 10px;
}
For functions.php
// Add thumbnail to excerpt
add_filter( 'the_excerpt', 'excerpt_thumbnail' );
function excerpt_thumbnail( $excerpt ){
if( is_single() ) return $excerpt;
global $post;
if ( has_post_thumbnail() ) {
$img .= '<a href="'.get_permalink($post->ID).'">'.get_the_post_thumbnail($post->ID, 'thumbnail').'</a>';
} else {
$img = '';
}
return $img.$excerpt;
}
Change in index.php
<?php /* The entry content */ ?>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&raquo;</span>', 'photocrati-framework' ) ); ?>
<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'photocrati-framework' ) . '&after=</div>') ?>
</div><!-- .entry-content -->
to
<?php /* The entry content */ ?>
<div class="entry-content">
<?php the_excerpt( __( 'Continue reading <span class="meta-nav">&raquo;</span>', 'photocrati-framework' ) ); ?>
<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'photocrati-framework' ) . '&after=</div>') ?>
</div><!-- .entry-content -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment