php – Divi – add title to mobile menu button

Question

I’m trying to add title to the link to mobile menu button in Divi theme. I don’t want to edit parent theme, so I created child theme and I try to extend class.

In functions.php I have:

function divichild_includes() {
    require_once get_theme_file_path( 'includes/class-divichild-menu.php' );
}
add_action( 'after_setup_theme', 'divichild_includes' );

and in class-divichild-menu.php:

class Divichild_Builder_Module_Menu extends ET_Builder_Module_Menu {

    public function render( $attrs, $content, $render_slug ) {

        $mobile_menu = sprintf(
            '<div class="et_mobile_nav_menu">
                <a href="#" class="mobile_nav closed%1$s" title="mobile menu">
                    <span class="mobile_menu_bar"></span>
                </a>
            </div>',
            'upwards' === $submenu_direction ? ' et_pb_mobile_menu_upwards' : ''
        );
    }
}

new Divichild_Builder_Module_Menu();

I’m getting fatal error “Class ET_Builder_Module_Menu not found”.

I tried with prepending ET_Builder_Module_Menu with “/” and with different priority of hook and it doesn’t work.

I know, I could add title with javascript, but I think, that doing it in php is more proper solution.

0
maja 1 week 2022-09-18T11:46:54-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse