add_action( 'genesis_before_post_title', 'insert_featured_image' ); function insert_featured_image() { if ( is_single() ){ if (has_post_thumbnail()){ the_post_thumbnail(); } } else if( is_category() ){ if (has_post_thumbnail()){ ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > <?php the_post_thumbnail(array(100), array('class' => 'alignleft', 'style' => 'padding:15px')); ?> </a><?php } remove_action('genesis_before_post_content' , 'genesis_post_info'); remove_action ('genesis_after_post_content','genesis_post_meta' ); add_filter('the_content', 'my_excerpts'); } else { remove_action('genesis_before_post_content' , 'genesis_post_info'); remove_action ('genesis_after_post_content','genesis_post_meta' ); remove_action('genesis_post_content', 'genesis_do_post_content'); } }
function my_excerpts($content = false) { global $post; // If is the home page, an archive, or search results if(is_front_page() || is_archive() || is_search()) : global $post; $content = $post->post_excerpt; // If an excerpt is set in the Optional Excerpt box if($content) : $content = apply_filters('the_excerpt', $content); // If no excerpt is set else : $content = $post->post_content; $excerpt_length = 50; $words = explode(' ', $content, $excerpt_length + 1); if(count($words) > $excerpt_length) : array_pop($words); array_push($words, '...'); $content = implode(' ', $words); endif; $content = ' ' . $content . ' '; endif; endif; $morelink = '<a class="more-link alignright" href="'. get_permalink($post->ID) . '">Read More...</a>'; // Make sure to return the content return $content.$morelink; }