Cómo sobrescribir funciones del tema padre en temas hijos
23 ene 2011, 15:28:02
Vistas: 17K
Votos: 31
He estado investigando y tratando de entender cómo hacer esto, pero por alguna razón no logro sobrescribir las funciones del tema padre en mi tema hijo.
Estoy usando TwentyTen como tema padre - ¿alguien puede decirme por qué esta función en mi tema hijo no está sobrescribiendo la función del padre?
// Sobrescribir el enlace "Leer más"
function osu_twentyten_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Continuar leyendo <span class="meta-nav">→</span>', 'twentyten-child' ) . '</a>';
}
function osu_twentyten_auto_excerpt_more( $more ) {
return ' …' . osu_twentyten_continue_reading_link();
}
remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
add_filter( 'excerpt_more', 'osu_twentyten_auto_excerpt_more' );
¿No se supone que hay que eliminar el filtro/acción antes de volver a agregarlo, verdad?
Gracias,
osu

Osu
1.45K
Todas las respuestas a la pregunta
1
1
Debes ejecutar el código después de la configuración del tema.
function osu_twentyten_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Leer más <span class="meta-nav">→</span>', 'twentyten-child' ) . '</a>';
}
function osu_twentyten_auto_excerpt_more( $more ) {
return ' …' . osu_twentyten_continue_reading_link();
}
function my_child_theme_setup() {
remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
add_filter( 'excerpt_more', 'osu_twentyten_auto_excerpt_more' );
}
add_action( 'after_setup_theme', 'my_child_theme_setup' );

sorich87
7.96K
23 ene 2011 15:34:42
Preguntas relacionadas
1
respuestas
1
respuestas
4
respuestas
1
respuestas