PluginProbe
HT Menu – WordPress Mega Menu Builder for Elementor / trunk
HT Menu – WordPress Mega Menu Builder for Elementor vtrunk
1.2.8 1.2.7 1.2.6 trunk 1.0.3 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 1.1.6 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5
ht-menu-lite / include / helper-function.php

helper-function.php in HT Menu – WordPress Mega Menu Builder for Elementor trunk, at include/helper-function.php

72 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if( ! defined( 'ABSPATH' ) ) exit();
5
6 /**
7 * Elementor category
8 */
9 if( !function_exists('htmega_menu_elementor_init') ){
10 function htmega_menu_elementor_init(){
11 \Elementor\Plugin::instance()->elements_manager->add_category(
12 'htmegamenu-addons',
13 [
14 'title' => __( 'HTMega Menu','htmega-menu'),
15 'icon' => 'font'
16 ],
17 1
18 );
19 }
20 add_action('elementor/init','htmega_menu_elementor_init');
21 }
22
23 /*
24 * Elementor Templates List
25 * return array
26 */
27 if( !function_exists('htmega_menu_elementor_template') ){
28 function htmega_menu_elementor_template() {
29 $templates = '';
30 if( class_exists('\Elementor\Plugin') ){
31 $templates = \Elementor\Plugin::instance()->templates_manager->get_source( 'local' )->get_items();
32 }
33 if ( empty( $templates ) ) {
34 $template_lists = [ '0' => __( 'Do not Saved Templates.', 'htmega-menu' ) ];
35 } else {
36 $template_lists = [ '0' => __( 'Select Template', 'htmega-menu' ) ];
37 foreach ( $templates as $template ) {
38 $template_lists[ $template['template_id'] ] = $template['title'] . ' (' . $template['type'] . ')';
39 }
40 }
41 return $template_lists;
42 }
43 }
44
45 /**
46 * Get all menu list
47 * return array
48 */
49 if( !function_exists('htmega_get_all_create_menus') ){
50 function htmega_get_all_create_menus() {
51 $raw_menus = wp_get_nav_menus();
52 $menus = wp_list_pluck( $raw_menus, 'name', 'term_id' );
53 $parent = isset( $_GET['parent_menu'] ) ? absint( $_GET['parent_menu'] ) : 0;
54 if ( 0 < $parent && isset( $menus[ $parent ] ) ) {
55 unset( $menus[ $parent ] );
56 }
57 return $menus;
58 }
59 }
60
61 /**
62 * Options return
63 */
64 if( !function_exists('htmega_menu_get_option') ){
65 function htmega_menu_get_option( $option, $section, $default = '' ){
66 $options = get_option( $section );
67 if ( isset( $options[$option] ) ) {
68 return $options[$option];
69 }
70 return $default;
71 }
72 }