????

Your IP : 18.119.135.67


Current Path : /home2/morganrand/backup.morganrand.com/wp-content/themes/wanderfuls/framework/
Upload File :
Current File : /home2/morganrand/backup.morganrand.com/wp-content/themes/wanderfuls/framework/menu-functions.php

<?php
/**
 * Header Menu Functions
 *
 * @package Wanderfuls WordPress Theme
 * @subpackage Framework
 */

/**
 * Returns correct menu classes
 *
 * @since 2.0.0
 */
function tb_header_menu_classes( $return ) {

	// Define classes array
	$classes = array();

	// Get data
	$header_style = tb_global_obj( 'header_style' );
	$has_overlay  = tb_global_obj( 'has_overlay_header' );

	// Return wrapper classes
	if ( 'wrapper' == $return ) {

		// Add Header Style to wrapper
		$classes[] = 'navbar-style-'. $header_style;

		// Add the fixed-nav class if the fixed header option is enabled
		if ( tb_get_mod( 'fixed_header', true )
			&& ( 'two' == $header_style
				|| 'three' == $header_style
				|| 'four' == $header_style
			)
		) {
			$classes[] = 'fixed-nav';
		}

		// Dropdown dropshadow
		if ( 'one' == $header_style || 'five' == $header_style || $has_overlay ) {
			$classes[] = 'tb-dropdowns-caret';
		}

		// Flush Dropdowns
		if ( tb_get_mod( 'menu_flush_dropdowns' )
			&& 'one' == $header_style
			&& ! $has_overlay
		) {
			$classes[] = 'tb-flush-dropdowns';
		}

		// Dropdown dropshadow
		if ( $shadow = tb_get_mod( 'menu_dropdown_dropshadow' ) ) {
			$classes[] = 'tb-dropdowns-shadow-'. $shadow;
		}

		// Add special class if the dropdown top border option in the admin is enabled
		if ( tb_get_mod( 'menu_dropdown_top_border' ) ) {
			$classes[] = 'tb-dropdown-top-border';
		}

		// Add clearfix
		$classes[] = 'clr';

		// Set keys equal to vals
		$classes = array_combine( $classes, $classes );

		// Apply filters
		$classes = apply_filters( 'tb_header_menu_wrap_classes', $classes );

	}

	// Inner Classes
	elseif ( 'inner' == $return ) {

		// Core
		$classes[] = 'navigation';
		$classes[] = 'main-navigation';
		$classes[] = 'clr';

		// Add the container div for specific header styles
		if ( in_array( $header_style, array( 'two', 'three', 'four' ) ) ) {
			$classes[] = 'container';
		}

		// Set keys equal to vals
		$classes = array_combine( $classes, $classes );

		// Apply filters
		$classes = apply_filters( 'tb_header_menu_classes', $classes );

	}

	// Return
	if ( is_array( $classes ) ) {
		return implode( ' ', $classes );
	} else {
		return $return;
	}

}

/**
 * Custom menu walker
 *
 * @since 1.3.0
 */
if ( ! class_exists( 'TB_Dropdown_Walker_Nav_Menu' ) ) {
	class TB_Dropdown_Walker_Nav_Menu extends Walker_Nav_Menu {
		function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {

			// Define vars
			$id_field = $this->db_fields['id'];
			$header_style = tb_global_obj( 'header_style' );

			// Down Arrows
			if ( ! empty( $children_elements[$element->$id_field] ) && ( $depth == 0 ) ) {
				$element->classes[] = 'dropdown';
				if ( tb_get_mod( 'menu_arrow_down' ) ) {
					$arrow_class = 'six' == $header_style ? 'fa-chevron-right' : 'fa-angle-down';
					$element->title .= ' <span class="nav-arrow top-level fa '. $arrow_class .'"></span>';
				}
			}

			// Right/Left Arrows
			if ( ! empty( $children_elements[$element->$id_field] ) && ( $depth > 0 ) ) {
				$element->classes[] = 'dropdown';
				if ( tb_get_mod( 'menu_arrow_side', true ) ) {
					if ( is_rtl() ) {
						$element->title .= '<span class="nav-arrow second-level fa fa-angle-left"></span>';
					} else {
						$element->title .= '<span class="nav-arrow second-level fa fa-angle-right"></span>';
					}
				}
			}

			// Define walker
			Walker_Nav_Menu::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );

		}
	}
}

/**
 * Checks for custom menus.
 *
 * @since 1.3.0
 */
function tb_custom_menu() {
	$menu = get_post_meta( tb_global_obj( 'post_id' ), 'tb_custom_menu', true );
	$menu = 'default' != $menu ? $menu : '';
	return apply_filters( 'tb_custom_menu', $menu );
}