Ticket #13361: cautiously_fancy_excerpts.diff
| File cautiously_fancy_excerpts.diff, 1.8 KB (added by iandstewart, 3 years ago) |
|---|
-
functions.php
249 249 add_filter( 'excerpt_length', 'twentyten_excerpt_length' ); 250 250 251 251 /** 252 * Re places "[...]" (appended to automatically generated excerpts) with an ellipsis.252 * Returns a "Continue Reading" link for excerpts 253 253 * 254 * @since Twenty Ten 1.0 255 * @return string "Continue Reading" link 256 */ 257 function twentyten_continue_reading_link() { 258 return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>'; 259 } 260 261 /** 262 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link(). 263 * 254 264 * To override this in a child theme, remove the filter and add your own 255 265 * function tied to the excerpt_more filter hook. 256 266 * … … 258 268 * @return string An ellipsis 259 269 */ 260 270 function twentyten_auto_excerpt_more( $more ) { 261 return ' …' ;271 return ' …' . twentyten_continue_reading_link(); 262 272 } 263 273 add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' ); 264 274 265 275 /** 266 * Adds a pretty "Continue Reading" link to post excerpts.276 * Adds a pretty "Continue Reading" link to custom post excerpts. 267 277 * 268 278 * To override this link in a child theme, remove the filter and add your own 269 279 * function tied to the get_the_excerpt filter hook. … … 272 282 * @return string Excerpt with a pretty "Continue Reading" link 273 283 */ 274 284 function twentyten_custom_excerpt_more( $output ) { 275 return $output . ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>'; 285 if ( has_excerpt() ) { 286 $output .= twentyten_continue_reading_link(); 287 } 288 return $output; 276 289 } 277 290 add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' ); 278 291
