Advertisement
Digitalraindrops

Read More and Posted On

Apr 12th, 2012
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. <?php
  2. add_action( 'after_setup_theme', 'child_theme_setup' );
  3.  
  4. /** This function will hold our new calls and over-rides */
  5. if ( !function_exists( 'child_theme_setup' ) ):
  6. function child_theme_setup() {
  7.    
  8.     /**
  9.     * Returns a "Read More" link for excerpts
  10.     */
  11.     function info_continue_reading_link() {
  12.         return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Read More <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
  13.     }
  14.     /**
  15.      * Change the "Continue Reading" link to custom post excerpts.
  16.      * remove the existeing filter and add our own
  17.      */
  18.     remove_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
  19.     remove_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
  20.    
  21.     function info_auto_excerpt_more( $more ) {
  22.         return '<br/> &hellip;' . info_continue_reading_link();
  23.     }
  24.     add_filter( 'excerpt_more', 'info_auto_excerpt_more' );
  25.  
  26.     function info_custom_excerpt_more( $output ) {
  27.         if ( has_excerpt() && ! is_attachment() ) {
  28.             $output .= info_continue_reading_link();
  29.         }
  30.         return $output;
  31.     }
  32.     add_filter( 'get_the_excerpt', 'info_custom_excerpt_more' );
  33.    
  34. }  
  35. endif;
  36.  
  37. if (!function_exists( 'twentyeleven_posted_on' ) ) :
  38. /**
  39.  * Create our own twentyeleven_posted_on to override parent function in our child theme
  40.  */
  41. function twentyeleven_posted_on() {
  42.     printf( __('<span class="by-author"> <span class="sep">Posted by </span> <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span></span>', 'twentyeleven' ),
  43.         esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
  44.         esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
  45.         get_the_author()
  46.     );
  47. }
  48. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement