HEX
Server: Apache
System: Linux pdx1-shared-a1-31 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: dh_5jabqq (6436002)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/dh_5jabqq/bermudashipwreckarchive.com/wp-content/themes/loquet/includes/menus.php
<?php
/*======
*
* Menus
*
======*/
register_nav_menus( 
	array(
		'main-menu' => esc_html__( 'Main Menu', 'loquet' ),
		'main-menu-left' => esc_html__( 'Main Menu Left', 'loquet' ),
		'main-menu-right' => esc_html__( 'Main Menu Right', 'loquet' ),
		'top-bar-menu' => esc_html__( 'Top Bar Menu', 'loquet' ),
		'off-canvas-menu' => esc_html__( 'Off Canvas Menu', 'loquet' ),
		'footer-menu' => esc_html__( 'Footer Menu', 'loquet' ),
	)
);



/*======
*
* Menu Walker
*
======*/
if( !class_exists( 'loquet_walker' ) ) {

	class loquet_walker extends Walker_Nav_Menu {

		public function start_lvl( &$output, $depth = 0, $args = array() ) {

			$indent = str_repeat( "\t", $depth );
			$output .= "\n$indent<ul role=\"menu\" class=\"gt-dropdown-menu\">\n";

		}
 
		function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {

			$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';

			$li_attributes = '';
			$class_names = $value = '';

			$classes = empty( $item->classes ) ? array() : (array) $item->classes;

			if($args->has_children){
				$classes[] 		= 'gt-dropdown';
				$li_attributes .= ' data-dropdown="dropdown"';
			}
			$classes[] = 'menu-item-' . $item->ID;
			$classes[] = ($item->current) ? 'active' : '';

			$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
			$class_names = ' class="' . esc_attr( $class_names ) . '"';

			$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
			$id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';

			$output .= $indent . '<li' . $id . $value . $class_names . $li_attributes . '>';

			$attributes = ! empty( $item->attr_title ) ? '' : '';
			$attributes = ! empty( $item->title ) ? ' data-title="' . esc_attr( $item->title ) .'"' : '';
			$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
			$attributes .= ! empty( $item->xfn ) ? ' rel="'	. esc_attr( $item->xfn ) .'"' : '';
			$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
			$attributes .= ! empty( $item->url ) ? '' : '';
			$attributes .= ($args->has_children) ? '' : ''; 

			$item_output = $args->before;
				$item_output .= '<a'. $attributes .'>';
					$item_output .= $args->link_before;
					$item_output .= apply_filters( 'the_title', $item->title, $item->ID );
					$item_output .= $args->link_after;
					$item_output .= ($args->has_children) ? '<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>' : '';
				$item_output .= '</a>';
			$item_output .= $args->after;

			$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );

		}

		public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {

			if( ! $element )
				return;
			$id_field = $this->db_fields['id'];
			// Display this element.
			if( is_object( $args[0] ) )
				$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
			parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );

		}

	}

}