Made a child theme, everything works well, except for one. In the parent theme there is a file /inc/wp_bootstrap_navwalker.php with a class and a function that need to be slightly modified (responsible for the menu operation).

class wp_bootstrap_navwalker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) { ... } } 

Is it possible to reassign this function or the entire class in a child theme?

  • Do you want not to use this class? Use menu building on its own principle? Or on the "factory template"? - pepel_xD
  • @pepel_xD I want to use menu building in my own way. Namely - I need to comment out a couple of lines in the original function. Is it possible to somehow do this in the child theme in order not to resort to changing the parent file? - federk
  • one
    You can completely describe the class as needed, in the template where the menu is displayed to refer to the new object. - pepel_xD
  • @pepel_xD Yes, just what you need. Thanks for the tip. Made header.php into which this class was added under a new name and addressed it - it worked. Apparently, this is the only possible solution. Add an answer, mark it as correct? - federk

1 answer 1

pepel_xD suggested the right solution:

It is necessary to fully describe the class as it should, in the template where the menu is displayed refer to the new object. In the header.php of the child theme I added this class under a new name and addressed it already - it worked.