Ticket #13361: fancier_excerpts.diff
File fancier_excerpts.diff, 1.8 KB (added by , 14 years ago) |
---|
-
functions.php
244 244 add_filter( 'excerpt_length', 'twentyten_excerpt_length' ); 245 245 246 246 /** 247 * Sets the "read more" link to something pretty.247 * Replaces the traditional "[…]" for marking of excerpts with a pretty "Continue Reading" link 248 248 * 249 * @since Twenty Ten 1.0 250 * @return replace the traditional "[…]" for marking of excerpts with a pretty "Continue Reading" link 251 */ 252 function twentyten_auto_excerpt_more( $more ) { 253 return $more .= ' … <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>';; 254 } 255 add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' ); 256 257 /** 258 * Adds a pretty "Continue Reading" link to custom post excerpts 259 * 249 260 * To override this link in a child theme, remove the filter and add your own 250 261 * function tied to the excerpt_more filter hook. 251 262 * 252 263 * @since Twenty Ten 1.0 253 * @return string A pretty 'Continue reading' link.264 * @return add a pretty "Continue Reading" link to custom post excerpts 254 265 */ 255 function twentyten_excerpt_more( $more ) { 256 return ' … <a href="'. get_permalink() . '">' . __('Continue reading <span class="meta-nav">→</span>', 'twentyten') . '</a>'; 266 function twentyten_custom_excerpt_more( $output ) { 267 if ( has_excerpt() ) { 268 $output .= ' … <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>'; 269 } 270 return $output; 257 271 } 258 add_filter( ' excerpt_more', 'twentyten_excerpt_more' );272 add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' ); 259 273 260 274 /** 261 275 * Remove inline styles printed when the gallery shortcode is used.