403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/successkpi/wp-content/themes/successkpi/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/successkpi/wp-content/themes/successkpi/inc//walker.php
<?php
/**
 * Custom Walker for Mega Menu
 */
class Custom_Walker_Nav_Menu extends Walker_Nav_Menu
{
    private $mega_parent = null;

    // Start Level (submenu)
    function start_lvl(&$output, $depth = 0, $args = null)
    {
        if ($depth === 0 && $this->mega_parent) {
            $output .= '<div class="dropdown-menu mega-menu p-3">';
        } else {
            $output .= '<ul class="dropdown-menu">';
        }
    }

    // End Level
    function end_lvl(&$output, $depth = 0, $args = null)
    {
        if ($depth === 0 && $this->mega_parent) {
            $output .= '</div>';
            $this->mega_parent = null;
        } else {
            $output .= '</ul>';
        }
    }

    // Start Element (menu item)
    function start_el(&$output, $item, $depth = 0, $args = null, $id = 0)
    {
        $item_classes = is_array($item->classes ?? null) ? $item->classes : array();
        $has_children = in_array('menu-item-has-children', $item_classes, true);
        $is_mega = get_field('enable_mega_menu', $item);

        // Build <li> classes
        $li_classes = ['nav-item'];
        if ($depth === 0) {
            if ($has_children || $is_mega) {
                $li_classes[] = 'sk-dropdown';
            }

            if ($is_mega) {
                $li_classes[] = 'sk-mega-parent';
                $this->mega_parent = $item->ID;
            }
        }

        if (in_array('current-menu-item', $item_classes, true) || in_array('current_page_item', $item_classes, true)) {
            $li_classes[] = 'active';
        }

        // Build <a> classes
        $a_classes = [];
        if ($depth > 0) {
            $a_classes[] = 'dropdown-item';
        } else {
            $a_classes[] = 'nav-link';
            if ($has_children || $is_mega) {
                $a_classes[] = 'dropdown-toggle';
            }
            if (in_array('current-menu-item', $item_classes, true) || in_array('current_page_item', $item_classes, true)) {
                $a_classes[] = 'active';
            }
        }

        $output .= '<li class="' . esc_attr(implode(' ', $li_classes)) . '">';

        $attr = !empty($item->url) ? ' href="' . esc_url($item->url) . '"' : ' href="#"';
        if ($depth === 0 && ($has_children || $is_mega)) {
            $attr .= ' role="button" data-bs-toggle="dropdown" aria-expanded="false"';
        }

        $output .= '<a class="' . esc_attr(implode(' ', $a_classes)) . '"' . $attr . '>';
        $output .= apply_filters('the_title', $item->title, $item->ID);
        if ($depth === 0 && ($has_children || $is_mega)) {
            $output .= ' <i class="fa fa-chevron-down sk-menu-arrow"></i>';
        }
        $output .= '</a>';

        // Render mega menu content only for this menu item
        if ($depth === 0 && $is_mega) {
            $output .= $this->render_mega_content($item->ID);
        }
    }

    // End Element
    function end_el(&$output, $item, $depth = 0, $args = null)
    {
        $output .= '</li>';
    }

    // Render Mega Menu Content for a specific menu item
    private function render_mega_content($id)
    {
        $title      = get_field('mega_menu_section_title', $id);
        $desc       = get_field('mega_menu_section_description', $id);
        $btn        = get_field('mega_menu_button_link', $id);

        ob_start(); ?>
        <div class="sk-mega-menu-wrapper">
            <div class="sk-mega-menu-row">
                <div class="sk-mega-menu-left">
                    <?php if ($title): ?><h6><?php echo esc_html($title); ?></h6><?php endif; ?>
                    <?php if ($desc): ?><p><?php echo esc_html($desc); ?></p><?php endif; ?>
                    <?php if ($btn && isset($btn['url'])): ?>
                        <a href="<?php echo esc_url($btn['url']); ?>"
                            class="btn btn-light btn-sm"
                            <?php if (!empty($btn['target'])) echo ' target="' . esc_attr($btn['target']) . '"'; ?>>
                            <?php echo esc_html($btn['title']); ?>
                        </a>
                    <?php endif; ?>
                </div>
                <div class="sk-mega-menu-right">
                    <?php
                    // Only output industry sections for THIS menu item
                    if (have_rows('industry_section', $id)) :
                        while (have_rows('industry_section', $id)) : the_row();

                            $industry_heading = get_sub_field('industry_heading');
                            $has_industries = have_rows('industries');

                            if (!empty($industry_heading) || $has_industries) :
                                echo '<div class="industry-list">';

                                if (!empty($industry_heading)) :
                                    echo '<h6>' . esc_html($industry_heading) . '</h6>';
                                endif;

                                if ($has_industries) :
                                    echo '<ul class="list-unstyled">';
                                    while (have_rows('industries')) : the_row();
                                        $link = get_sub_field('industry_link');
                                        if ($link && isset($link['url'])) :
                                            echo '<li>';
                                            echo '<a href="' . esc_url($link['url']) . '"';
                                            echo !empty($link['target']) ? ' target="' . esc_attr($link['target']) . '"' : '';
                                            echo '>' . esc_html($link['title']) . '</a>';
                                            echo '</li>';
                                        endif;
                                    endwhile;
                                    echo '</ul>';
                                endif;

                                echo '</div>';
                            endif;

                        endwhile;
                    endif;
                    ?>

                </div>

            </div>
            <?php $hover_link =  get_field('hover_link', $id);
            if (isset($hover_link) && !empty($hover_link)):   ?>
                <div class="menu-button">
                    <a href="<?php echo esc_url($hover_link['url']); ?>"
                        target="<?php echo esc_attr($hover_link['target']); ?>">
                        <?php echo esc_html($hover_link['title']); ?> <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a>
                </div>
            <?php endif; ?>
        </div>
    <?php return ob_get_clean();
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit