I'm having trouble using remove_filter
to override the read more links in my parent theme.
Here's the parent theme functions:
/* Modify the '[...]' Read More Text */
add_filter( 'the_content_more_link', 'hoot_modify_read_more_link' );
if ( apply_filters( 'hoot_force_excerpt_readmore', true ) ) {
add_filter( 'excerpt_more', 'hoot_insert_excerpt_readmore_quicktag', 11 );
add_filter( 'wp_trim_excerpt', 'hoot_replace_excerpt_readmore_quicktag', 11, 2 );
} else {
add_filter( 'excerpt_more', 'hoot_modify_read_more_link' );
}
/**
* Modify the '[...]' Read More Text
*
* @since 1.0
* @access public
* @return string
*/
function hoot_modify_read_more_link( $more = '[…]' ) {
if ( is_admin() )
return $more;
$read_more = esc_html( hoot_get_mod('read_more') );
$read_more = ( empty( $read_more ) ) ? sprintf( __( 'Read More %s', 'brigsby' ), '→' ) : $read_more;
global $post;
$read_more = '<a class="more-link" href="' . esc_url( get_permalink( $post->ID ) ) . '">' . $read_more . '</a>';
return apply_filters( 'hoot_readmore', $read_more ) ;
}
And here's my functions in my child theme's function.php:
function dw_remove_parent_read_more() {
remove_filter('excerpt_more', 'hoot_modify_read_more_link');
}
add_action('after_setup_theme', 'dw_remove_parent_read_more',999);
function dw_modify_read_more_link($more = '[…]') {
if ( is_admin() )
return $more;
$read_more = esc_html( hoot_get_mod('read_more') );
$read_more = ( empty( $read_more ) ) ? sprintf( __( 'Read More %s', 'brigsby' ), '' ) : $read_more;
global $post;
$read_more = '<div><a class="more-link" href="' . esc_url( get_permalink( $post->ID ) ) . '">' . $read_more . '</a></div>';
return apply_filters( 'hoot_readmore', $read_more ) ;
}
add_filter('excerpt_more', 'dw_modify_read_more_link', 999);
The current result is that two read more links are now showing, both the parent theme's and my child theme's. What am I doing wrong :) ?