WordPress.org

Forums

remove filter - custom continue reading link (1 post)

  1. Matthew W
    Member
    Posted 3 years ago #

    hey folks, I'm trying to remove twentyeleven's Continue Reading link so I can insert my own. I've read about 27 posts on this topic, but for some reason just can't get it working. Any advice on my mistake or the problem would be greatly appreciated.

    This should remove the filters, but it doesn't:

    function child_theme_setup() {
    	// override parent theme's 'more' text for excerpts
    	remove_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
    	remove_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
    }
    add_action( 'after_setup_theme', 'child_theme_setup' );

    If the remove ever works, I'll add a new link like so:

    // Defines readmore link
    function custom_continue_reading_link() {
    	return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Please continue reading.', 'twentyeleven' ) . '</a>';
    }
    
    // Replaces "[...]"
    function custom_auto_excerpt_more( $more ) {
    	return ' &hellip;' . custom_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'custom_auto_excerpt_more' );

Topic Closed

This topic has been closed to new replies.

About this Topic