Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created child of theme twentyten. I tried to override function written below

    /**
 * Returns a "Continue Reading" link for excerpts
 *
 * @since Twenty Ten 1.0
 * @return string "Continue Reading" link
 */
function twentyten_continue_reading_link() {
    return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
}

/**
 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
 *
 * To override this in a child theme, remove the filter and add your own
 * function tied to the excerpt_more filter hook.
 *
 * @since Twenty Ten 1.0
 * @return string An ellipsis
 */
function twentyten_auto_excerpt_more( $more ) {
    return ' &hellip;' . twentyten_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

It says to override this in a child theme, remove the filter and add your own function tied to the excerpt_more filter hook. I don't want to make any change in the parent theme folder so created functions.php in child theme folder. I write my function in child file functions.php as below

f

 function twentyten_continue_reading_link_() {
    return ' <a href="'. get_permalink() . '">' . __( 'READ MORE', 'twentyten' ) . '</a>';
}


function twentyten_auto_excerpt_more_( $more ) {
    return ' &hellip;' . twentyten_continue_reading_link_();
}
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more_' );

But I have to comment filter written in the parent to make the new one working. Is it possible to do without modifying in parent file functions.php.

Any help will be appreciated. Thanks in advance

share|improve this question
add comment

1 Answer

Hi using Function Reference/remove action and usingFunction Reference/remove filter.using these two functions only we can overriding the functions.

share|improve this answer
    
Thank you Ramkumar ... I used this and it worked add_action( 'after_setup_theme', 'my_child_theme_setup' ); function my_child_theme_setup() { // We are providing our own filter for excerpt_length (or using the unfiltered value) remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' ); } –  user478 Jul 1 '11 at 5:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.