Advertisement
alchymyth

serach continue reading Twenty Eleven

Jun 21st, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1. add_action( 'after_setup_theme', 'twentyeleven_child_continue_reading_setup' );
  2.  
  3. function twentyeleven_child_continue_reading_setup() {
  4. remove_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
  5. add_filter( 'get_the_excerpt', 'twentyeleven_child_custom_excerpt_more' );
  6.  
  7. remove_filter( 'excerpt_more', 'twentyeleven_child_auto_excerpt_more' );
  8. add_filter( 'excerpt_more', 'twentyeleven_child_auto_excerpt_more' );
  9. }
  10.  
  11. function twentyeleven_child_custom_excerpt_more($output ) {
  12.     if ( is_search() && has_excerpt() && ! is_attachment() ) {
  13.     //edited 'continue reading' for search results//
  14.         $output .= ' <a href="'. esc_url( get_permalink() ) . '">' . 'Search Results Continue Reading <span class="meta-nav">&rarr;</span>' . '</a>';
  15.     }   elseif ( has_excerpt() && ! is_attachment() ) {
  16.         $output .= ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
  17.     }
  18.     return $output;
  19. }
  20.  
  21. function twentyeleven_child_auto_excerpt_more($output ) {
  22.     //edited 'continue reading' for search results//
  23.     if( is_search() ) { return ' &hellip;' . ' <a href="'. esc_url( get_permalink() ) . '">' . 'Search Results Continue Reading <span class="meta-nav">&rarr;</span>' . '</a>';
  24.     } else { return ' &hellip;' . twentyeleven_continue_reading_link();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement