Visualizzazione 3 filoni di risposte
Visualizzazione 3 filoni di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › WP e Accessibilità › tag <!–more–>
Salve mi sapreste dire quale funzione del core traduce il commento <!–more–> nel link dell’articolo intero?
mi serve perché per l’accessibilità web i link devono essere correlati con l’attributo “title” che non viene generato dalla funzione…
grazie
ho risolto, ho modificato il file wp-includes/post-template.php dove c’é la funzione get_the_content(…
ora il problema è che un file del core… come potrei fare la cosa senza intaccare le funzionalità del core? cosଠda non perderla in futuri aggiornamenti di WordPress????
Ti fai una copia del file…
basta fare due righe di funzione nel file function.php del tuo tema una cosa del tipo:
// Remove the # anchor from the more link in the_content
function my_more_link( $more_link, $more_link_text ) {
return str_replace($more_link, ‘< a rel = “nofollow” href=”‘ . get_permalink() . ‘”>’.$more_link_text.'< /a >’, $more_link );
}
Ovviamente adattando la parte centrale di str_replace. In tal modo hai il controllo sul codice gerato dal tag more senza toccare file di core di wordpress.
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0