How can I apply filters in my class that extends Walker_Nav_Menu?
Pergunta
I have the following piece of abridged code:
<?php
class New_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth, $args) {
$attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$output .= '<li><a'. $attributes .'>';
$output .= apply_filters( 'the_title', 'modifyTitle', $item->ID );
$output .= '</a></li>';
}
function modifyTitle($title){
return $title . asd;
}
}
?>
Is this the right way to do it?
Nenhuma solução correta
Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange