| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.5/wp-content/themes/woodmart/inc/shortcodes/ |
Upload File : |
<?php
/**
* Shortcode for Mega Menu element.
*
* @package woodmart
*/
if ( ! defined( 'WOODMART_THEME_DIR' ) ) {
exit( 'No direct script access allowed' );
}
use XTS\Modules\Mega_Menu_Walker;
if ( ! function_exists( 'woodmart_shortcode_mega_menu' ) ) {
/**
* Mega Menu shortcode.
*
* @param array $atts Shortcode attributes.
*
* @return string
*/
function woodmart_shortcode_mega_menu( $atts ) {
$output = '';
$title_html = '';
$class = apply_filters( 'vc_shortcodes_css_class', '', '', $atts );
$atts = shortcode_atts(
array(
'title' => '',
'nav_menu' => '',
'style' => 'default',
'design' => 'vertical',
'dropdown_design' => 'default',
'items_gap' => 's',
'vertical_items_gap' => 's',
'alignment' => '',
'color' => '',
'icon_alignment' => 'inherit',
'woodmart_color_scheme' => 'light',
'el_class' => '',
'menu_classes' => '',
'el_id' => '',
'woodmart_css_id' => '',
'css' => '',
'is_wpb' => true,
'items_bg_color_enable' => 'no',
'items_bg_hover_color_enable' => 'no',
'items_bg_active_color_enable' => 'no',
'items_border_enable' => 'no',
'items_border_hover_enable' => 'no',
'items_border_active_enable' => 'no',
'items_box_shadow_enable' => 'no',
'items_box_shadow_hover_enable' => 'no',
'items_box_shadow_active_enable' => 'no',
'disable_active_style' => 'no',
),
$atts
);
$title_classes = ' color-scheme-' . esc_attr( $atts['woodmart_color_scheme'] );
if ( function_exists( 'vc_shortcode_custom_css_class' ) ) {
$class .= ' ' . vc_shortcode_custom_css_class( $atts['css'] );
}
if ( ! empty( $atts['el_class'] ) ) {
$class .= ' ' . trim( $atts['el_class'] );
}
if ( ! empty( $atts['el_id'] ) ) {
$widget_id = $atts['el_id'];
} else {
$widget_id = 'wd-' . $atts['woodmart_css_id'];
}
$menu_classes = ' wd-nav-' . $atts['design'];
if ( 'horizontal' === $atts['design'] ) {
if ( $atts['alignment'] ) {
$class .= ' text-' . $atts['alignment'];
}
$menu_classes .= ' wd-style-' . $atts['style'];
$menu_classes .= ' wd-gap-' . $atts['items_gap'];
}
if ( 'vertical' === $atts['design'] ) {
$menu_classes .= ' wd-design-' . $atts['dropdown_design'];
if ( 'simple' === $atts['dropdown_design'] ) {
$menu_classes .= ' wd-gap-' . $atts['vertical_items_gap'];
}
}
if ( $atts['icon_alignment'] && 'inherit' !== $atts['icon_alignment'] ) {
$menu_classes .= ' wd-icon-' . $atts['icon_alignment'];
}
if ( ! empty( $atts['menu_classes'] ) ) {
$menu_classes .= $atts['menu_classes'];
}
$items_bg_activated = 'yes' === $atts['items_bg_color_enable'] || 'yes' === $atts['items_bg_hover_color_enable'] || 'yes' === $atts['items_bg_active_color_enable'];
$items_border_active = 'yes' === $atts['items_border_enable'] || 'yes' === $atts['items_border_hover_enable'] || 'yes' === $atts['items_border_active_enable'];
$items_box_shadow_active = 'yes' === $atts['items_box_shadow_enable'] || 'yes' === $atts['items_box_shadow_hover_enable'] || 'yes' === $atts['items_box_shadow_active_enable'];
if ( $items_bg_activated || $items_box_shadow_active || $items_border_active ) {
$menu_classes .= ' wd-add-pd';
}
if ( 'yes' === $atts['disable_active_style'] ) {
$menu_classes .= ' wd-dis-act';
}
ob_start();
woodmart_enqueue_inline_style( 'el-menu' );
if ( ! empty( $atts['is_wpb'] ) ) {
woodmart_enqueue_inline_style( 'el-menu-wpb-elem' );
}
if ( 'vertical' === $atts['design'] ) {
woodmart_enqueue_inline_style( 'mod-nav-vertical' );
woodmart_enqueue_inline_style( 'mod-nav-vertical-design-' . $atts['dropdown_design'] );
}
if ( 'horizontal' === $atts['design'] && 'bg' === $atts['style'] ) {
woodmart_enqueue_inline_style( 'bg-navigation' );
}
?>
<div id="<?php echo esc_attr( $widget_id ); ?>" class="wd-menu widget_nav_mega_menu wd-nav-wrapper<?php echo esc_attr( $class ); ?>">
<?php if ( 'vertical' === $atts['design'] && $atts['title'] ) : ?>
<h5 class="widget-title<?php echo esc_attr( $title_classes ); ?>">
<?php echo wp_kses( $atts['title'], woodmart_get_allowed_html() ); ?>
</h5>
<?php endif; ?>
<?php
wp_nav_menu(
array(
'fallback_cb' => '',
'container' => '',
'menu' => $atts['nav_menu'],
'menu_class' => 'menu wd-nav' . $menu_classes,
'walker' => new Mega_Menu_Walker(),
)
);
?>
<?php
if ( $atts['color'] && ! woodmart_is_css_encode( $atts['color'] ) ) {
$atts['css'] = '#' . esc_attr( $widget_id ) . ' .widget-title {';
$atts['css'] .= 'background-color: ' . esc_attr( $atts['color'] ) . ';';
$atts['css'] .= '}';
wp_add_inline_style( 'woodmart-inline-css', $atts['css'] );
}
?>
</div>
<?php
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}