What is the significance of the "aktiv" class in the PHP code provided for submenu visibility?

The "aktiv" class in the PHP code provided is significant for determining the visibility of the submenu. It is likely used to apply styling or functionality to the active submenu item. To ensure the submenu visibility works correctly, the "aktiv" class should be added to the active submenu item when it is selected.

<?php
// Check if the current page is the submenu item and add the "aktiv" class
function is_submenu_active($submenu_item) {
    global $post;
    
    if (is_page($submenu_item) || $post->post_parent == get_page_by_title($submenu_item)->ID) {
        echo 'aktiv';
    }
}

// Usage example
<ul>
    <li class="<?php is_submenu_active('Submenu Item 1'); ?>"><a href="#">Submenu Item 1</a></li>
    <li class="<?php is_submenu_active('Submenu Item 2'); ?>"><a href="#">Submenu Item 2</a></li>
</ul>
?>