I need to modify function start_el of class "Walker_Nav_Menu extends Walker". add_filter hook added to function.php not working. How I can resolve it. Thank you!
I need to modify function start_el of class "Walker_Nav_Menu extends Walker". add_filter hook added to function.php not working. How I can resolve it. Thank you!
Not sure if you're still looking for the answer to this or not... However, walkers are a little bit different than filters or actions. You would need something like this in your functions.php:
class Your_Class_Name extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth, $args) {
/* Your custom code goes here.
* I encourage you to copy the existing Walker_Nav_Menu
* and then just make your changes.
*/
}
}
Then, when you call a menu in your template files, make sure to include 'walker' => new Your_Class_Name() in your array that specifies the arguments for wp_nav_menu().
Hope that helps....
Many thanks JPry !
I don't know about viter-z-bayraku, but your comment made me save a good amount of time :)
This topic has been closed to new replies.