mspaly
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: Getting Rid Of "Continue Reading" in the_excerpt()1. Create a child theme so that you don’t lose your changes when upgrading wordpress.
2. Add the following code to change to your custom value. My situation called for a ‘more’ link. Put in whatever text/markup you want. This code first removes the excerpt ‘more’ filters from the Twenty Ten parent theme. Then it replicates the functions and makes a call to its own function where you can control the ‘more’ text/markup.
Notes: To remove the more link altogether, just use the top 5 lines and leave out the duplicate functions/add_filters below. To increase the excerpt length, add your own excerpt_length function and filter and remove the twentyten_excerpt_length filter.
add_action( 'after_setup_theme', 'mc_setup' ); function mc_setup() { remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' ); remove_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' ); } function mc_auto_excerpt_more( $more ) { return ' …' . mc_custom_more_link(); } add_filter( 'excerpt_more', 'mc_auto_excerpt_more' ); function mc_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= mc_custom_more_link(); } return $output; } add_filter( 'get_the_excerpt', 'mc_custom_excerpt_more' ); function mc_custom_more_link(){ return '<div class="excerpt-more"><a href="'. get_permalink() . '">' . __( 'more') . '</a></div>'; }
Viewing 1 replies (of 1 total)