Come sovrascrivere le funzioni del tema genitore nei child theme?
23 gen 2011, 15:28:02
Visualizzazioni: 17K
Voti: 31
Ho cercato in giro e provato a capire come fare, ma per qualche motivo non riesco a sovrascrivere le funzioni del tema genitore nel mio child theme.
Sto usando TwentyTen come tema genitore - qualcuno può spiegarmi perché questa funzione nel mio child theme non sovrascrive quella del genitore?
// Sovrascrivi il link "Continua a leggere"
function osu_twentyten_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Continua a leggere <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' );
Pensavo che bisognasse prima rimuovere il filtro/azione ecc. prima di riaggiungerlo, giusto?
Grazie,
osu

Osu
1.45K
Tutte le risposte alla domanda
1
1
Dovresti eseguire il codice dopo la configurazione del tema.
function osu_twentyten_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Continua a leggere <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 gen 2011 15:34:42
Domande correlate
1
risposte
1
risposte