Example #1
0
 /**
  * @return bool
  * Function reset menu for theme
  */
 function set_menus()
 {
     $tp_menus = wp_get_nav_menus();
     @($menu_nav_settings = thim_file_get_contents(MENU_CONFIG));
     $menu_reading_settings = thim_file_get_contents(MENU_READING_CONFIG);
     if ($menu_reading_settings) {
         $menu_reading_settings = array_filter(explode(',', $menu_reading_settings));
     }
     if (count($menu_reading_settings)) {
         if (isset($menu_reading_settings[1]) && trim($menu_reading_settings[0]) == 'page') {
             update_option('show_on_front', trim($menu_reading_settings[0]));
             $page = get_page_by_title(trim($menu_reading_settings[1]));
             if ($page) {
                 update_option('page_on_front', $page->ID);
             }
         }
     }
     //get all registered menu locations
     @($locations = get_theme_mod('nav_menu_locations'));
     if ($menu_nav_settings) {
         $menu_nav_settings = explode("\n", $menu_nav_settings);
         $menu_nav_settings = array_filter($menu_nav_settings);
         $menu_nav = array();
         for ($i = 0; $i < count($menu_nav_settings); $i++) {
             $key_nav = explode(',', $menu_nav_settings[$i]);
             if (count($key_nav) > 1) {
                 @($menu_nav[trim(strtolower(str_replace(' ', '_', trim($key_nav[0]))))] = trim($key_nav[1]));
             }
         }
     }
     //get all created menus
     if (!empty($tp_menus) && !empty($menu_nav)) {
         foreach ($tp_menus as $tp_menu) {
             //check if we got a menu that corresponds to the Menu name array ($menu_nav) we have set in functions.php
             if (is_object($tp_menu) && in_array($tp_menu->name, $menu_nav)) {
                 $key = array_search($tp_menu->name, $menu_nav);
                 //update the theme
                 if ($key) {
                     //if we have found a menu with the correct menu name apply the id to the menu location
                     $locations[$key] = $tp_menu->term_id;
                 }
             }
         }
     } else {
         return false;
     }
     @set_theme_mod('nav_menu_locations', $locations);
     if (class_exists('Woocommerce')) {
         // Set pages
         $woopages = array('woocommerce_shop_page_id' => 'Shop', 'woocommerce_cart_page_id' => 'Cart', 'woocommerce_checkout_page_id' => 'Checkout', 'woocommerce_pay_page_id' => 'Checkout &#8594; Pay', 'woocommerce_thanks_page_id' => 'Order Received', 'woocommerce_myaccount_page_id' => 'My Account', 'woocommerce_edit_address_page_id' => 'Edit My Address', 'woocommerce_view_order_page_id' => 'View Order', 'woocommerce_change_password_page_id' => 'Change Password', 'woocommerce_logout_page_id' => 'Logout', 'woocommerce_lost_password_page_id' => 'Lost Password');
         foreach ($woopages as $woo_page_name => $woo_page_title) {
             $woopage = get_page_by_title($woo_page_title);
             if (isset($woopage->ID)) {
                 update_option($woo_page_name, $woopage->ID);
                 // Front Page
             }
         }
     }
     return true;
 }
Example #2
0
 function register()
 {
     // Init Post Type
     $post = new SpyropressCustomPostType('Page');
     $menus = wp_get_nav_menus();
     $menu_options = array();
     if (isset($menus) && count($menus) > 0) {
         foreach ($menus as $menu) {
             $menu_options[$menu->term_id] = $menu->name;
         }
     }
     // Add Meta Boxes
     $meta_fields['options'] = array(array('label' => __('Slider', 'spyropress'), 'type' => 'heading', 'slug' => 'options'), array('label' => __('OnePage Navigation Menu', 'spyropress'), 'id' => 'onepage_menu', 'type' => 'select', 'class' => 'page_template one-page-php', 'options' => $menu_options), array('label' => __('Slider', 'spyropress'), 'type' => 'sub_heading'), array('label' => __('Slider Type', 'spyropress'), 'id' => 'slider', 'type' => 'select', 'class' => 'enable_changer', 'options' => array('nivo' => __('Nivo Slider', 'spyropress'), 'rev' => __('Revolution Slider', 'spyropress'))), array('label' => __('Nivo Slider', 'spyropress'), 'id' => 'nivo_slider', 'type' => 'select', 'class' => 'slider nivo', 'options' => spyropress_get_sliders()));
     if (class_exists('RevSlider')) {
         $slider = new RevSlider();
         $arrSliders = $slider->getArrSlidersShort();
         $meta_fields['options'][] = array('label' => __('Revolution Slider', 'spyropress'), 'id' => 'rev_slider', 'type' => 'select', 'class' => 'slider rev', 'options' => $arrSliders);
         $meta_fields['options'][] = array('label' => __('Revolution Slider Skin', 'spyropress'), 'id' => 'rev_slider_skin', 'type' => 'select', 'class' => 'slider rev', 'options' => array('dark' => __('Dark', 'spyropress'), 'light' => __('Light', 'spyropress'), 'full' => __('FullScreen', 'spyropress'), 'dark dark-video' => __('Video - Dark', 'spyropress'), 'light dark-light' => __('Video - Light', 'spyropress')), 'std' => 'dark');
     }
     $meta_fields['options'][] = array('label' => __('Header', 'spyropress'), 'type' => 'sub_heading');
     $meta_fields['options'][] = array('label' => __('Header Type', 'spyropress'), 'id' => 'top_header', 'type' => 'select', 'class' => 'enable_changer', 'options' => array('none' => __('None', 'spyropress'), 'default' => __('Default', 'spyropress'), 'custom' => __('Custom Header', 'spyropress')), 'std' => 'default');
     $meta_fields['options'][] = array('label' => __('Custom Header Bucket', 'spyropress'), 'id' => 'bucket', 'type' => 'select', 'class' => 'top_header custom', 'desc' => __('Either use Bucket or Content', 'spyropress'), 'options' => spyropress_get_buckets());
     $meta_fields['options'][] = array('label' => __('Custom Header Content', 'spyropress'), 'id' => 'header_content', 'type' => 'editor', 'desc' => __('Either use Bucket or Content', 'spyropress'), 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Custom Header Background', 'spyropress'), 'id' => 'background', 'type' => 'background', 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Top Border color', 'spyropress'), 'id' => 'border_top', 'type' => 'colorpicker', 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Bottom Border color', 'spyropress'), 'id' => 'border_bottom', 'type' => 'colorpicker', 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Layout', 'spyropress'), 'type' => 'sub_heading');
     $meta_fields['options'][] = array('label' => __('Layout Type', 'spyropress'), 'id' => 'layout_type', 'type' => 'select', 'options' => array('full' => __('Full Width', 'spyropress'), 'left' => __('Left Sidebar', 'spyropress'), 'right' => __('Right Sidebar', 'spyropress')), 'std' => 'full');
     $post->add_meta_box('page_options', __('Page Options', 'spyropress'), $meta_fields, '_page_options', false, 'normal', 'high');
 }
Example #3
0
function cs_shortcode_menu_render($atts)
{
    extract(shortcode_atts(array('title' => '', 'nav_menu' => '', 'el_class' => '', 'menu_align' => 'left', 'menu_line_height' => '80', 'css' => '', 'bg_image' => '', 'bg_color' => '', 'bg_image_repeat' => '', 'padding' => '', 'margin_bottom' => ''), $atts));
    ob_start();
    global $smof_data;
    $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cs_custom_header_menu' . $el_class . $el_class . vc_shortcode_custom_css_class($css, ' '), 'cs-shortcode-menu', $atts);
    ?>
    <div id="menu" class="cs_mega_menu main-menu cs-menu-align-<?php 
    echo $menu_align;
    ?>
 cs-menu-line-height-<?php 
    echo $menu_line_height;
    ?>
 <?php 
    echo $css_class;
    ?>
">
		<div class="main-menu-content cshero-menu-dropdown clearfix nav-menu cshero-mobile">
			<?php 
    $menus = wp_get_nav_menus();
    if ($nav_menu) {
        echo '<ul class="cshero-dropdown main-menu">';
        wp_nav_menu(array('theme_location' => 'main_navigation', 'menu' => $nav_menu, 'depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s', 'walker' => new HeroMenuWalker()));
        if (is_active_sidebar('cshero-header-content-widget-1')) {
            ?>
                        <li>
                            <div class="header-cart-search">
                                <?php 
            if (!function_exists('dynamic_sidebar') || !dynamic_sidebar("Header Content Widget 1")) {
            }
            ?>
                            </div>
                        </li>
                        <?php 
        }
        if (isset($smof_data['enable_hidden_sidebar']) && $smof_data['enable_hidden_sidebar'] && !isMobile()) {
            ?>
                        <li>
                            <a href="#"><i class="fa fa-navicon cs_open"></i></a>
                        </li>
                        <?php 
        }
        echo '</ul>';
    } elseif (empty($menus)) {
        echo '<div class="menu-pages">';
        wp_nav_menu(array('depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s'));
        echo '</div>';
    } else {
        echo '<ul class="cshero-dropdown main-menu">';
        wp_nav_menu(array('depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s', 'walker' => new HeroMenuWalker()));
        echo '</ul>';
    }
    ?>
		</div>
	</div>
	<button type="button" class="btn btn-default btn-navbar navbar-toggle" data-toggle="collapse" data-target="#cshero-main-menu-mobile"><i class="fa fa-align-justify"></i></button>
	<div id="cshero-main-menu-mobile" class="collapse navbar-collapse cshero-mmenu"></div>
    <?php 
    return ob_get_clean();
}
 function __construct()
 {
     $this->id = $GLOBALS['asmh']->settings['middle_menu_id'];
     $this->menu = $GLOBALS['asmh']->settings['middle_menu'];
     $this->has_description = $GLOBALS['asmh']->settings['show_description'];
     $this->navs = wp_get_nav_menus();
 }
Example #5
0
function kt_register_meta_boxes($meta_boxes)
{
    $prefix = '_kt_';
    $menus = wp_get_nav_menus();
    $menus_arr = array('' => esc_html__('Default', 'adroit'));
    foreach ($menus as $menu) {
        $menus_arr[$menu->term_id] = esc_html($menu->name);
    }
    $sidebars = array();
    foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
        $sidebars[$sidebar['id']] = ucwords($sidebar['name']);
    }
    $tabs = array('page_layout' => array('label' => esc_html__('Layout', 'adroit'), 'icon' => 'fa fa-columns'), 'page_background' => array('label' => esc_html__('Background', 'adroit'), 'icon' => 'fa fa-picture-o'));
    $fields = array(array('name' => esc_html__('Page layout', 'adroit'), 'id' => $prefix . 'layout', 'desc' => esc_html__("Please choose this page's layout.", 'adroit'), 'type' => 'select', 'options' => array('default' => esc_html__('Default', 'adroit'), 'full' => esc_html__('Full width Layout', 'adroit'), 'boxed' => esc_html__('Boxed Layout', 'adroit')), 'std' => 'default', 'tab' => 'page_layout'), array('name' => esc_html__('Sidebar configuration', 'adroit'), 'id' => $prefix . 'sidebar', 'desc' => esc_html__("Choose the sidebar configuration for the detail page.<br/><b>Note: Cart and checkout, My account page always use no sidebars.</b>", 'adroit'), 'type' => 'select', 'options' => array(0 => esc_html__('Default', 'adroit'), 'full' => esc_html__('No sidebars', 'adroit'), 'left' => esc_html__('Left Sidebar', 'adroit'), 'right' => esc_html__('Right Sidebar', 'adroit')), 'std' => 'default', 'tab' => 'page_layout'), array('name' => esc_html__('Left sidebar', 'adroit'), 'id' => $prefix . 'left_sidebar', 'type' => 'select', 'tab' => 'page_layout', 'options' => $sidebars, 'desc' => esc_html__("Select your sidebar.", 'adroit'), 'visible' => array($prefix . 'sidebar', '=', 'left')), array('name' => esc_html__('Right sidebar', 'adroit'), 'id' => $prefix . 'right_sidebar', 'type' => 'select', 'tab' => 'page_layout', 'options' => $sidebars, 'desc' => esc_html__("Select your sidebar.", 'adroit'), 'visible' => array($prefix . 'sidebar', '=', 'right')), array('name' => esc_html__('Page top spacing', 'adroit'), 'id' => $prefix . 'page_top_spacing', 'desc' => esc_html__("Enter your page top spacing (Example: 100px).", 'adroit'), 'type' => 'text', 'tab' => 'page_layout'), array('name' => esc_html__('Page bottom spacing', 'adroit'), 'id' => $prefix . 'page_bottom_spacing', 'desc' => esc_html__("Enter your page bottom spacing (Example: 100px).", 'adroit'), 'type' => 'text', 'tab' => 'page_layout'), array('name' => esc_html__('Extra page class', 'adroit'), 'id' => $prefix . 'extra_page_class', 'desc' => esc_html__('If you wish to add extra classes to the body class of the page (for custom css use), then please add the class(es) here.', 'adroit'), 'type' => 'text', 'tab' => 'page_layout'), array('name' => esc_html__('Background', 'adroit'), 'id' => $prefix . 'background_body', 'type' => 'background', 'tab' => 'page_background', 'desc' => esc_html__('The option that will be used as the OUTER page.', 'adroit')), array('name' => esc_html__('Inner Background', 'adroit'), 'id' => $prefix . 'background_inner', 'type' => 'background', 'tab' => 'page_background', 'desc' => esc_html__('The option that will be used as the INNER page.', 'adroit')));
    $tabs_page = array('header' => array('label' => esc_html__('Header', 'adroit'), 'icon' => 'fa fa-desktop'), 'page_header' => array('label' => esc_html__('Page Header', 'adroit'), 'icon' => 'fa fa-bars'));
    $fields_page = array(array('name' => esc_html__('Page Header', 'adroit'), 'id' => $prefix . 'page_header', 'desc' => esc_html__("Show Page Header.", 'adroit'), 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'page_header'), array('name' => esc_html__('Page Header Custom Text', 'adroit'), 'id' => $prefix . 'page_header_custom', 'desc' => esc_html__("Enter cstom Text for page header.", 'adroit'), 'type' => 'text', 'tab' => 'page_header', 'visible' => array($prefix . 'page_header', '!=', 'off')), array('name' => esc_html__('Page header subtitle', 'adroit'), 'id' => $prefix . 'page_header_subtitle', 'desc' => esc_html__("Enter subtitle for page.", 'adroit'), 'type' => 'text', 'tab' => 'page_header', 'visible' => array($prefix . 'page_header', '!=', 'off')), array('name' => esc_html__('Header position', 'adroit'), 'type' => 'select', 'id' => $prefix . 'header_position', 'desc' => esc_html__("Please choose header position", 'adroit'), 'options' => array('default' => esc_html__('Default', 'adroit'), 'below' => esc_html__('Below Slideshow', 'adroit')), 'std' => 'default', 'tab' => 'header'), array('name' => esc_html__('Select Your Slideshow Type', 'adroit'), 'id' => $prefix . 'slideshow_type', 'desc' => esc_html__("You can select the slideshow type using this option.", 'adroit'), 'type' => 'select', 'options' => array('' => esc_html__('Select Option', 'adroit'), 'revslider' => esc_html__('Revolution Slider', 'adroit'), 'layerslider' => esc_html__('Layer Slider', 'adroit')), 'tab' => 'header'), array('name' => esc_html__('Select Revolution Slider', 'adroit'), 'id' => $prefix . 'rev_slider', 'default' => true, 'type' => 'revSlider', 'tab' => 'header', 'desc' => esc_html__('Select the Revolution Slider.', 'adroit'), 'visible' => array($prefix . 'slideshow_type', '=', 'revslider')), array('name' => esc_html__('Select Layer Slider', 'adroit'), 'id' => $prefix . 'layerslider', 'default' => true, 'type' => 'layerslider', 'tab' => 'header', 'desc' => esc_html__('Select the Layer Slider.', 'adroit'), 'visible' => array($prefix . 'slideshow_type', '=', 'layerslider')));
    /**
     * For Page Options
     *
     */
    $meta_boxes[] = array('id' => 'page_meta_boxes', 'title' => esc_html__('Page Options', 'adroit'), 'pages' => array('page'), 'tabs' => array_merge($tabs, $tabs_page), 'fields' => array_merge($fields, $fields_page));
    $tabs_post = array('post_general' => array('label' => esc_html__('General', 'adroit'), 'icon' => 'fa fa-bars'), 'post_header' => array('label' => esc_html__('Header', 'adroit'), 'icon' => 'fa fa-desktop'));
    $fields_post = array(array('type' => 'image_radio', 'name' => esc_html__('Post layouts', 'adroit'), 'desc' => esc_html__('Select the your post layout.', 'adroit'), 'id' => "{$prefix}blog_post_layout", 'options' => array('' => array('url' => KT_FW_IMG . 'single/default.jpg', 'alt' => esc_html__('Default', 'adroit')), 1 => array('url' => KT_FW_IMG . 'single/layout-1.jpg', 'alt' => esc_html__('Layout 1', 'adroit')), 2 => array('url' => KT_FW_IMG . 'single/layout-2.jpg', 'alt' => esc_html__('Layout 2', 'adroit')), 3 => array('url' => KT_FW_IMG . 'single/layout-3.jpg', 'alt' => esc_html__('Layout 3', 'adroit')), 4 => array('url' => KT_FW_IMG . 'single/layout-4.jpg', 'alt' => esc_html__('Layout 4', 'adroit')), 5 => array('url' => KT_FW_IMG . 'single/layout-5.jpg', 'alt' => esc_html__('Layout 5', 'adroit')), 6 => array('url' => KT_FW_IMG . 'single/layout-6.jpg', 'alt' => esc_html__('Layout 6', 'adroit'))), 'attributes' => '', 'std' => '', 'tab' => 'post_general'), array('name' => esc_html__('Previous & next buttons', 'adroit'), 'id' => "{$prefix}prev_next", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')), array('name' => esc_html__('Author info', 'adroit'), 'id' => "{$prefix}author_info", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')), array('name' => esc_html__('Social sharing', 'adroit'), 'id' => "{$prefix}social_sharing", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')), array('name' => esc_html__('Related articles', 'adroit'), 'id' => "{$prefix}related_acticles", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')));
    /**
     * For Posts Options
     *
     */
    $meta_boxes[] = array('id' => 'post_meta_boxes', 'title' => 'Post Options', 'pages' => array('post'), 'tabs' => array_merge($tabs_post, $tabs), 'fields' => array_merge($fields_post, $fields));
    return $meta_boxes;
}
        /**
         * Render the content on the theme customizer page
         */
        public function render_content()
        {
            ?>
                    <label>
                      <span class="customize-menu-dropdown"><?php 
            echo esc_html($this->label);
            ?>
</span>
                      <select name="<?php 
            echo $this->id;
            ?>
" id="<?php 
            echo $this->id;
            ?>
">
                        <?php 
            $menus = wp_get_nav_menus($args);
            if ($menus) {
                foreach ($menus as $menu) {
                    echo '<option value="' . $menu->term_id . '"' . selected($this->value, $menu->term_id) . '>' . $menu->name . '</option>';
                }
            }
            ?>
                      </select>
                    </label>
                <?php 
        }
Example #7
0
 function us_dataImport()
 {
     if (!defined('WP_LOAD_IMPORTERS')) {
         define('WP_LOAD_IMPORTERS', true);
     }
     require_once get_template_directory() . '/vendor/wordpress-importer/wordpress-importer.php';
     if (!is_file(get_template_directory() . '/xml/demo_data.xml')) {
         echo "Automatic import failed. Please use the wordpress importer and import the XML file (Astra/xml/demo_data.xml) manually.";
     } else {
         $wp_import = new WP_Import();
         $wp_import->fetch_attachments = true;
         $wp_import->import(get_template_directory() . '/xml/demo_data.xml');
         // Set menu
         $locations = get_theme_mod('nav_menu_locations');
         $menus = wp_get_nav_menus();
         if (!empty($menus)) {
             foreach ($menus as $menu) {
                 if (is_object($menu) && $menu->name == 'Astra Main Menu') {
                     $locations['astra_main_menu'] = $menu->term_id;
                 }
                 if (is_object($menu) && $menu->name == 'Astra Footer Menu') {
                     $locations['astra_footer_menu'] = $menu->term_id;
                 }
             }
         }
         set_theme_mod('nav_menu_locations', $locations);
     }
     die;
 }
 /**
  * Footer menu fallback
  */
 function bigblank_footer_menu_fallback()
 {
     $menus = wp_get_nav_menus();
     if (!empty($menus)) {
         return wp_nav_menu(array('container' => 'nav', 'depth' => 1, 'container_id' => 'footer-nav'));
     }
 }
Example #9
0
function ubermenu_integration_code_ui($config_id)
{
    $integration_code = '<div class="ubermenu-integration-code-wrap">' . ubermenu_menu_integration_code(array(), $config_id);
    $menu_select = '<h4>Integrate Specific Menu</h4>';
    $loc_select = '<h4>Integrate Specific Theme Location</h4>';
    $menus = wp_get_nav_menus(array('orderby' => 'name'));
    if (is_array($menus)) {
        foreach ($menus as $menu) {
            $integration_code .= ubermenu_menu_integration_code(array('menu' => $menu->term_id), $config_id);
        }
        $menu_select .= '<select class="ubermenu-manual-code-menu-selection">';
        $menu_select .= '<option value="_default">Default</option>';
        foreach ($menus as $menu) {
            $menu_select .= '<option value="' . $menu->term_id . '">' . $menu->name . '</option>';
        }
        $menu_select .= '</select>';
        $menu_select .= '<p class="ubermenu-sub-desc ubermenu-desc-understated">To display a specific menu, select the menu above to generate that code</p>';
    }
    $locs = get_registered_nav_menus();
    if (is_array($locs)) {
        foreach ($locs as $loc_id => $loc_name) {
            $integration_code .= ubermenu_menu_integration_code(array('theme_location' => $loc_id), $config_id);
        }
        $loc_select .= '<select class="ubermenu-manual-code-menu-selection">';
        $loc_select .= '<option value="_default">None</option>';
        foreach ($locs as $loc_id => $loc_name) {
            $loc_select .= '<option value="' . $loc_id . '">' . $loc_name . '</option>';
        }
        $loc_select .= '</select>';
        $loc_select .= '<p class="ubermenu-sub-desc ubermenu-desc-understated">To display a specific theme locaton, select the theme location above to generate that code</p>';
    }
    $integration_code .= $menu_select . $loc_select;
    $integration_code .= '</div>';
    return $integration_code;
}
 /**
  * Returns all the settings fields
  *
  * @return array settings fields
  */
 function get_settings_fields()
 {
     $locations = get_nav_menu_locations();
     /*
     $locations = Array
     	(
     		[location_name] = > currently_assigned_menu_id
     		[primary] => 12
     		[sidebar] => 2
     		[footer] => 0
     		
     	)
     */
     $exclude_theme_locations_opt = array();
     foreach ($locations as $key => $val) {
         $exclude_theme_locations_opt[$key] = ucfirst($key);
     }
     // Get menus
     $menus = wp_get_nav_menus();
     $exclude_menus_opt = array();
     foreach ($menus as $menu) {
         $exclude_menus_opt[$menu->term_id . "|" . $menu->slug . "|" . $menu->name] = $menu->name;
     }
     $settings_fields = array('wp_nav_menu_cache' => array(array('name' => 'exclude_theme_locations', 'label' => 'Exclude Theme Locations', 'desc' => "Check theme location you don't want to cache any menu of", 'type' => 'multicheck', 'options' => $exclude_theme_locations_opt), array('name' => 'exclude_menus', 'label' => 'Exclude Menus', 'desc' => "Check wich menu you don't want to cache.<br>You need this if you use Custom Menu widget or if you assign a menu with the call of wp_nav_menu() function in theme files.", 'type' => 'multicheck', 'options' => $exclude_menus_opt), array('name' => 'individual_url', 'label' => 'Cache for Individual URL', 'desc' => 'Enable <br><span style="color:#ff0000">You should not enable this option if you have a huge number of <strong>posts/pages</strong> on your site.<br>This option caches each menu individually <strong>for each post/page or any visited url</strong>.<br>This can result in a <strong>huge number of cached menu files</strong> on your site, which could actually resulted in a <strong>slower site</strong>.<br>It could also cross the <strong>limitation of number of files</strong> in a single directory.</span>', 'type' => 'checkbox')));
     return $settings_fields;
 }
Example #11
0
 protected function getMenus($args = [])
 {
     $defaults = ['orderby' => 'name'];
     $args = wp_parse_args($args, $defaults);
     $menus = wp_get_nav_menus(apply_filters('g5_assignments_get_menus_args', $args));
     return $menus;
 }
Example #12
0
 public function __construct()
 {
     $this->cssclass = 'row-options';
     $this->description = __('Set row options and styling here.', 'spyropress');
     $this->id_base = 'spyropress_row_options';
     $this->name = __('Row Options', 'spyropress');
     $this->show_custom_css = true;
     $locations = get_registered_nav_menus();
     $menus = wp_get_nav_menus();
     $menu_options = array();
     if (isset($locations) && count($locations) > 0 && isset($menus) && count($menus) > 0) {
         foreach ($menus as $menu) {
             $menu_options[$menu->term_id] = $menu->name;
         }
     }
     // Fields
     $this->fields = array(array('id' => 'show', 'type' => 'checkbox', 'options' => array('1' => '<strong>' . __('Disable this row temporarily', 'spyropress') . '</strong>')), array('id' => 'container_skin', 'type' => 'select', 'class' => 'enable_changer section-full', 'label' => __('Style/Skin', 'spyropress'), 'options' => array('home-intro' => __('Call of Action', 'spyropress'), 'featured_section call-to-action footer' => __('Call-to-Action (Featured)', 'spyropress'), 'home-intro light' => __('Call of Action (Light)', 'spyropress'), 'home-concept' => __('Home Concept', 'spyropress'), 'featured_section' => __('Featured Section', 'spyropress'), 'highlight_section' => __('Hightlight', 'spyropress'), 'highlight_section top' => __('Hightlight (no top-margin)', 'spyropress'), 'featured_section highlight_section footer' => __('Featured Hightlight Section', 'spyropress'), 'push-top' => __('Push Top', 'spyropress'), 'parallax' => __('Parallax', 'spyropress'), 'video_section' => __('Video', 'spyropress'))), array('label' => __('Parallax Background', 'spyropress'), 'id' => 'parallax_bg', 'class' => 'parallax container_skin section-full', 'type' => 'upload'), array('label' => __('Video Poster', 'spyropress'), 'id' => 'video_poster', 'class' => 'video_section container_skin section-full', 'type' => 'upload'), array('label' => __('Video MP4', 'spyropress'), 'id' => 'video_mp4', 'class' => 'video_section container_skin section-full', 'type' => 'upload'), array('label' => __('Video OGG', 'spyropress'), 'id' => 'video_ogg', 'class' => 'video_section container_skin section-full', 'type' => 'upload'));
     if (!empty($menu_options)) {
         $this->fields[] = array('label' => __('OnePage Menu Builder', 'spyropress'), 'type' => 'sub_heading');
         $this->fields[] = array('label' => __('Select Menu', 'spyropress'), 'id' => 'menu_id', 'type' => 'select', 'options' => $menu_options);
         $this->fields[] = array('label' => __('Menu Label', 'spyropress'), 'id' => 'menu_label', 'type' => 'text');
     }
     $this->create_widget();
     add_filter('builder_save_row_css', array($this, 'compile_css'), 10, 3);
 }
function _wpsc_menu_exists($args)
{
    $args = (object) $args;
    // Get the nav menu based on the requested menu
    $menu = wp_get_nav_menu_object($args->menu);
    // Get the nav menu based on the theme_location
    if (!$menu && $args->theme_location && ($locations = get_nav_menu_locations()) && isset($locations[$args->theme_location])) {
        $menu = wp_get_nav_menu_object($locations[$args->theme_location]);
    }
    // get the first menu that has items if we still can't find a menu
    if (!$menu && !$args->theme_location) {
        $menus = wp_get_nav_menus();
        foreach ($menus as $menu_maybe) {
            if ($menu_items = wp_get_nav_menu_items($menu_maybe->term_id)) {
                $menu = $menu_maybe;
                break;
            }
        }
    }
    // If the menu exists, get its items.
    if ($menu && !is_wp_error($menu) && !isset($menu_items)) {
        $menu_items = wp_get_nav_menu_items($menu->term_id);
    }
    // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists
    if (!$menu || is_wp_error($menu) || isset($menu_items) && empty($menu_items) && !$args->theme_location) {
        return false;
    }
    // If no fallback function was specified and the menu doesn't exists, bail.
    if (!$menu || is_wp_error($menu) || empty($menu_items)) {
        return false;
    }
    return (bool) $menu;
}
Example #14
0
 function __construct()
 {
     self::$menus = [];
     foreach (wp_get_nav_menus() as $menu) {
         self::$menus[$menu->slug] = $menu;
     }
 }
 function customize_registering($wp_customize)
 {
     global $xili_language;
     // in_nav_menu
     $locations = get_registered_nav_menus();
     $menus = wp_get_nav_menus();
     $menu_locations = get_nav_menu_locations();
     $num_locations = count(array_keys($locations));
     if ($num_locations >= 1 && count($menu_locations) >= 1) {
         $wp_customize->add_section('xili_options_section', array('title' => __('Multilingual Options ©xili', 'xili-language'), 'priority' => 300, 'description' => sprintf(_n('Your theme supports %s menu. Customize style.', 'Your theme supports %s menus. Customize style.', $num_locations, 'xili-language'), number_format_i18n($num_locations)) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.')));
         $location_slugs = array_keys($locations);
         if (0 == $xili_language->has_languages_list_menu($location_slugs[0])) {
             // only test one menu during transition
             $wp_customize->add_setting('xili_language_settings[in_nav_menu]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('in_nav_menu', array('settings' => 'xili_language_settings[in_nav_menu]', 'label' => __('Append the languages', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'radio', 'choices' => array('disable' => __('No languages menu-items', 'xili-language'), 'enable' => __('Show languages menu-items', 'xili-language'))));
             $wp_customize->add_setting('xili_language_settings[nav_menu_separator]', array('default' => '|', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('nav_menu_separator', array('settings' => 'xili_language_settings[nav_menu_separator]', 'label' => __('Separator before language list (Character or Entity Number or Entity Name)', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'text'));
         }
         if (!current_theme_supports('custom_xili_flag')) {
             $wp_customize->add_setting($this->settings_name . '[no_flags]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('no_flags', array('settings' => $this->settings_name . '[no_flags]', 'label' => __('Hide the flags', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'checkbox'));
         }
     } else {
         $wp_customize->add_section('xili_options_section', array('title' => __('Multilingual Options ©xili', 'xili-language'), 'priority' => 300, 'description' => __('None nav menus location seems active', 'xili-language')));
     }
     $wp_customize->add_setting($this->settings_name . '[linked_posts]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
     $wp_customize->add_control('linked_posts', array('settings' => $this->settings_name . '[linked_posts]', 'label' => __('Show linked posts', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'checkbox'));
 }
Example #16
0
function ubermenu_add_toolbar_items($admin_bar)
{
    if (!current_user_can('manage_options')) {
        return;
    }
    if (ubermenu_op('ubermenu_toolbar', 'general') != 'on') {
        return;
    }
    $admin = is_admin();
    $admin_bar->add_node(array('id' => 'ubermenu', 'title' => ubermenu_toolbar_icon('gears') . 'UberMenu', 'href' => admin_url('themes.php?page=ubermenu-settings'), 'meta' => array('title' => __('UberMenu', 'UberMenu'))));
    $admin_bar->add_node(array('id' => 'ubermenu_customize', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('eye') . __('Customize', 'ubermenu'), 'href' => admin_url('customize.php'), 'meta' => array('title' => __('Configure the UberMenu Settings', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_control_panel', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('sliders') . __('UberMenu Control Panel', 'ubermenu'), 'href' => admin_url('themes.php?page=ubermenu-settings'), 'meta' => array('title' => '<i class="fa fa-sliders"></i> ' . __('Configure the UberMenu Settings', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_edit_menus', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('pencil') . __('Edit Menus', 'ubermenu'), 'href' => admin_url('nav-menus.php'), 'meta' => array('title' => __('Add, remove, and configure menu items', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $menus = wp_get_nav_menus(array('orderby' => 'name'));
    foreach ($menus as $menu) {
        $admin_bar->add_node(array('id' => 'ubermenu_edit_menus_' . $menu->slug, 'parent' => 'ubermenu_edit_menus', 'title' => $menu->name, 'href' => admin_url('nav-menus.php?action=edit&menu=' . $menu->term_id), 'meta' => array('title' => __('Configure', 'ubermenu') . ' ' . $menu->name, 'target' => '_blank', 'class' => '')));
    }
    $admin_bar->add_node(array('id' => 'ubermenu_assign_menus', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('bars') . __('Assign Menus', 'ubermenu'), 'href' => admin_url('nav-menus.php?action=locations'), 'meta' => array('title' => __('Theme Location Manager', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_knowledgebase', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('book') . __('Knowledgebase', 'ubermenu'), 'href' => UBERMENU_KB_URL, 'meta' => array('title' => __('UberMenu Knowledgebase / Support Guide', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_docs', 'parent' => 'ubermenu_knowledgebase', 'title' => ubermenu_toolbar_icon('book') . __('Documentation', 'ubermenu'), 'href' => UBERMENU_KB_URL, 'meta' => array('title' => __('UberMenu Knowledgebase / Support Guide', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_video_tutorials', 'parent' => 'ubermenu_knowledgebase', 'title' => ubermenu_toolbar_icon('video-camera') . __('Video Tutorials', 'ubermenu'), 'href' => UBERMENU_VIDEOS_URL, 'meta' => array('title' => __('UberMenu Video Tutorials', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_support', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('life-ring') . __('Support / Help', 'ubermenu'), 'href' => UBERMENU_SUPPORT_URL, 'meta' => array('title' => __('UberMenu Support Center', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    if (!is_admin()) {
        //Diagnostics
        if (ubermenu_op('diagnostics', 'general') == 'on') {
            $admin_bar->add_node(array('id' => 'ubermenu_diagnostics', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('stethoscope') . __('Diagnostics (Alpha)', 'ubermenu'), 'href' => '#', 'meta' => array('title' => __('Load diagnostics script (experimental feature in Alpha development)', 'ubermenu'), 'class' => 'ubermenu-diagnostics-loader-button')));
        }
        //Loading Message
        $admin_bar->add_node(array('id' => 'ubermenu_loading', 'title' => ubermenu_toolbar_icon('exclamation-triangle') . ' UberMenu Loading...', 'href' => '#'));
        $loading_msg = __('If this message does not disappear, it means that UberMenu\'s javascript has not been able to load.  This most commonly indicates that you have a javascript error on this page, which will need to be resolved in order to allow UberMenu to run.', 'ubermenu');
        //$loading_msg.= ' <a target="_blank" href="http://goo.gl/oS6L6C">How to check for javascript errors.</a>';
        $admin_bar->add_node(array('id' => 'ubermenu_loading_msg', 'parent' => 'ubermenu_loading', 'title' => $loading_msg, 'href' => 'http://goo.gl/oS6L6C', 'meta' => array('target' => '_blank')));
    }
}
    public function form($instance)
    {
        $title = isset($instance['title']) ? $instance['title'] : '';
        $nav_menu = isset($instance['offcanvas_nav_menu']) ? $instance['offcanvas_nav_menu'] : '';
        // Get menus
        $menus = wp_get_nav_menus();
        // If no menus exists, direct the user to go and create some.
        if (!$menus) {
            echo '<p>' . sprintf(__('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php')) . '</p>';
            return;
        }
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:');
        ?>
</label>
			<input type="text" class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($title);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('offcanvas_nav_menu');
        ?>
"><?php 
        _e('Select Menu:');
        ?>
</label>
			<select id="<?php 
        echo $this->get_field_id('offcanvas_nav_menu');
        ?>
" name="<?php 
        echo $this->get_field_name('offcanvas_nav_menu');
        ?>
">
				<option value="0"><?php 
        _e('&mdash; Select &mdash;');
        ?>
</option>
		<?php 
        foreach ($menus as $menu) {
            echo '<option value="' . $menu->term_id . '"' . selected($nav_menu, $menu->term_id, false) . '>' . esc_html($menu->name) . '</option>';
        }
        ?>
			</select>
		</p>
		<?php 
    }
 public function nav_menu_terms()
 {
     $nav_menus = wp_get_nav_menus();
     foreach ($nav_menus as &$term) {
         $term->description = '';
     }
     return $nav_menus;
 }
Example #19
0
function shiftnav_get_nav_menu_ops()
{
    $menus = wp_get_nav_menus(array('orderby' => 'name'));
    $m = array('_none' => 'Choose Menu, or use Theme Location Setting');
    foreach ($menus as $menu) {
        $m[$menu->slug] = $menu->name;
    }
    return $m;
}
Example #20
0
function YA_shortcodeVC()
{
    $target_arr = array(__('Same window', 'yatheme') => '_self', __('New window', 'yatheme') => "_blank");
    $link_category = array(__('All Links', 'yatheme') => '');
    $link_cats = get_categories();
    if (is_array($link_cats)) {
        foreach ($link_cats as $link_cat) {
            $link_category[$link_cat->name] = $link_cat->term_id;
        }
    }
    //category product
    $terms = get_terms('product_cat', array('parent' => 0, 'hide_emty' => false));
    if (count($terms) == 0) {
        return;
    }
    $term = array(__('All Category Product', 'yatheme') => '');
    foreach ($terms as $cat) {
        $term[$cat->name] = $cat->term_id;
    }
    // hot category
    $terms1 = get_terms('product_cat', array('parent' => 0, 'hide_emty' => false));
    if (count($terms1) == 0) {
        return;
    }
    $term = array(__('', 'yatheme') => '');
    foreach ($terms1 as $cat) {
        $term1[$cat->name] = $cat->term_id;
    }
    $args = array('type' => 'post', 'child_of' => 0, 'parent' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'product_cat', 'pad_counts' => false);
    $product_categories_dropdown = array(__('All Category Product', 'yatheme') => '');
    $categories = get_categories($args);
    foreach ($categories as $category) {
        $product_categories_dropdown[$category->name] = $category->term_id;
    }
    $menu_locations_array = array(__('All Links', 'yatheme') => '');
    $menu_locations = wp_get_nav_menus();
    foreach ($menu_locations as $menu_location) {
        $menu_locations_array[$menu_location->name] = $menu_location->term_id;
    }
    /* YTC VC */
    // ytc tesminial
    vc_map(array('name' => 'YTC_ ' . __('Testimonial Slide', 'yatheme'), 'base' => 'testimonial_slide', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('The tesminial on your site', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Style title', 'yatheme'), 'param_name' => 'style_title', 'value' => array('Select type', __('Style title 1', 'yatheme') => 'title1', __('Style title 2', 'yatheme') => 'title2', __('Style title 3', 'yatheme') => 'title3'), 'description' => __('What text use as a style title. Leave blank to use default style title.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of posts to show', 'yatheme'), 'param_name' => 'numberposts', 'admin_label' => true), array('type' => 'textfield', 'heading' => __('Excerpt length (in words)', 'yatheme'), 'param_name' => 'length', 'description' => __('Excerpt length (in words).', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Template', 'yatheme'), 'param_name' => 'type', 'value' => array(__('Indicators Up', 'yatheme') => 'indicators_up', __('Slide Style 1', 'yatheme') => 'slide1', __('Slide Style 2', 'yatheme') => 'slide2', __('Style Our Service', 'yatheme') => 'ourservice'), 'description' => sprintf(__('Chose template for testimonial', 'yatheme'))), array('type' => 'dropdown', 'heading' => __('Order way', 'yatheme'), 'param_name' => 'order', 'value' => array(__('Descending', 'yatheme') => 'DESC', __('Ascending', 'yatheme') => 'ASC'), 'description' => __('Designates the ascending or descending order. More at %s.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Order by', 'yatheme'), 'param_name' => 'orderby', 'value' => array('Select orderby', __('Date', 'yatheme') => 'date', __('ID', 'yatheme') => 'ID', __('Author', 'yatheme') => 'author', __('Title', 'yatheme') => 'title', __('Modified', 'yatheme') => 'modified', __('Random', 'yatheme') => 'rand', __('Comment count', 'yatheme') => 'comment_count', __('Menu order', 'yatheme') => 'menu_order'), 'description' => __('Select how to sort retrieved posts. More at %s.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    //ytc our brand
    vc_map(array('name' => 'YTC_ ' . __('Brand', 'yatheme'), 'base' => 'OurBrand', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('The best sale  product on your site', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Style title', 'yatheme'), 'param_name' => 'style_title', 'value' => array('Select type', __('Style title 1', 'yatheme') => 'title1', __('Style title 2', 'yatheme') => 'title2', __('Style title 3', 'yatheme') => 'title3', __('Style title 4', 'yatheme') => 'title4'), 'description' => __('What text use as a style title. Leave blank to use default style title.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Type display', 'yatheme'), 'param_name' => 'type', 'value' => array('Select type', __('Type default', 'yatheme') => 'default', __('Type slide', 'yatheme') => 'slide'), 'description' => __('type you want display.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of posts to show', 'yatheme'), 'param_name' => 'numberposts', 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('Order way', 'yatheme'), 'param_name' => 'order', 'value' => array(__('Descending', 'yatheme') => 'DESC', __('Ascending', 'yatheme') => 'ASC'), 'description' => __('Designates the ascending or descending order. More at %s.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Order by', 'yatheme'), 'param_name' => 'orderby', 'value' => array('Select orderby', __('Date', 'yatheme') => 'date', __('ID', 'yatheme') => 'ID', __('Author', 'yatheme') => 'author', __('Title', 'yatheme') => 'title', __('Modified', 'yatheme') => 'modified', __('Random', 'yatheme') => 'rand', __('Comment count', 'yatheme') => 'comment_count', __('Menu order', 'yatheme') => 'menu_order'), 'description' => __('Select how to sort retrieved posts. More at %s.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Speed slide', 'yatheme'), 'param_name' => 'interval', 'description' => __('Speed for slide', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Effect slide', 'yatheme'), 'param_name' => 'effect', 'value' => array(__('Slide', 'yatheme') => 'slide', __('Fade', 'yatheme') => 'fade'), 'description' => __('Effect for slide', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Hover slide', 'yatheme'), 'param_name' => 'hover', 'value' => array(__('Yes', 'yatheme') => 'hover', __('No', 'yatheme') => ''), 'description' => __('Hover for slide', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Swipe slide', 'yatheme'), 'param_name' => 'swipe', 'value' => array(__('Yes', 'yatheme') => 'yes', __('No', 'yatheme') => 'no'), 'description' => __('Swipe for slide', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of Columns >1200px:', 'yatheme'), 'param_name' => 'columns', 'description' => __('Number colums you want display  > 1200px.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of Columns on 768px to 1199px:', 'yatheme'), 'param_name' => 'columns1', 'description' => __('Number colums you want display  on 768px to 1199px.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of Columns on 480px to 767px:', 'yatheme'), 'param_name' => 'columns2', 'description' => __('Number colums you want display  on 480px to 767px.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of Columns on 321px to 479px:', 'yatheme'), 'param_name' => 'columns3', 'description' => __('Number colums you want display  on 321px to 479px.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Number of Columns in 320px or less than:', 'yatheme'), 'param_name' => 'columns4', 'description' => __('Number colums you want display  in 320px or less than.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    //// vertical mega menu
    vc_map(array('name' => 'YTC ' . __('vertical mega menu', 'yatheme'), 'base' => 'ya_mega_menu', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('Display vertical mega menu', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('param_name' => 'style', 'type' => 'dropdown', 'value' => array('Style Default' => '', 'Style 1' => 'style1'), 'heading' => __('Style Vertical Menu', 'yatheme'), 'description' => '', 'holder' => 'div'), array('param_name' => 'menu_locate', 'type' => 'dropdown', 'value' => $menu_locations_array, 'heading' => __('Category menu:', 'overmax'), 'description' => '', 'holder' => 'div', 'class' => ''), array('type' => 'dropdown', 'heading' => __('Theme shortcode want display', 'yatheme'), 'param_name' => 'widget_template', 'value' => array(__('default', 'yatheme') => 'default'), 'description' => sprintf(__('Select different style menu.', 'yatheme'))), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    ///// Gallery
    vc_map(array('name' => __('YTC_Gallery', 'yatheme'), 'base' => 'gallerys', 'icon' => 'icon-wpb-images-carousel', 'category' => __('My shortcodes', 'yatheme'), 'description' => __('Animated carousel with images', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'yatheme'), 'param_name' => 'title', 'description' => __('Enter text which will be used as widget title. Leave blank if no title is needed.', 'yatheme')), array('type' => 'attach_images', 'heading' => __('Images', 'yatheme'), 'param_name' => 'ids', 'value' => '', 'description' => __('Select images from media library.', 'yatheme')), array('type' => 'textfield', 'heading' => __('gallery size', 'yatheme'), 'param_name' => 'size', 'description' => __('Enter image size. Example: thumbnail, medium, large, full or other sizes defined by current theme. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use "thumbnail" size. If used slides per view, this will be used to define carousel wrapper size.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Gallery caption', 'yatheme'), 'param_name' => 'caption', 'value' => array(__('true', 'yatheme') => 'true', __('false', 'yatheme') => 'false'), 'description' => __('Images display caption true or false', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Gallery type', 'yatheme'), 'param_name' => 'type', 'value' => array(__('column', 'yatheme') => 'column', __('slide', 'yatheme') => 'slide', __('flex', 'yatheme') => 'flex'), 'description' => __('Images display type', 'yatheme')), array('type' => 'textfield', 'heading' => __('gallery columns', 'yatheme'), 'param_name' => 'columns', 'description' => __('Enter gallery columns. Example: 1,2,3,4 ... Only use gallery type="column".', 'yatheme')), array('type' => 'textfield', 'heading' => __('Slider speed', 'yatheme'), 'param_name' => 'interval', 'value' => '5000', 'description' => __('Duration of animation between slides (in ms)', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Gallery event', 'yatheme'), 'param_name' => 'event', 'value' => array(__('slide', 'yatheme') => 'slide', __('fade', 'yatheme') => 'fade'), 'description' => __('event slide images', 'yatheme')), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    /////////////////// best sale /////////////////////
    vc_map(array('name' => 'YTC_' . __('Best Sale', 'yatheme'), 'base' => 'BestSale', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('Display bestseller', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Style title', 'yatheme'), 'param_name' => 'style_title', 'description' => __('What text use as a style title. Leave blank to use default style title.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Template', 'yatheme'), 'param_name' => 'template', 'value' => array('Select type', __('Default', 'yatheme') => 'default', __('Slide', 'yatheme') => 'slide'), 'description' => sprintf(__('Select different style best sale.', 'yatheme'))), array('type' => 'textfield', 'heading' => __('Number of posts to show', 'yatheme'), 'param_name' => 'number', 'admin_label' => true), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    /////////////////// YA Recommend/////////////////////
    vc_map(array('name' => __('YA Recommend Products', 'yatheme'), 'base' => 'ya_recommend', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('Recommend Products', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('type' => 'dropdown', 'holder' => 'div', 'class' => '', 'heading' => __("Category", "smartaddons"), 'param_name' => "category", 'value' => $term, 'description' => __("Select Categories", "smartaddons")), array('type' => 'textfield', 'heading' => __('Number of product to show', 'yatheme'), 'param_name' => 'numberposts', 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('Order way', 'yatheme'), 'param_name' => 'order', 'value' => array(__('Descending', 'yatheme') => 'DESC', __('Ascending', 'yatheme') => 'ASC'), 'description' => __('Designates the ascending or descending order. More at %s.', 'yatheme')), array('type' => 'dropdown', 'heading' => __('Order by', 'yatheme'), 'param_name' => 'orderby', 'value' => array('Select orderby', __('Date', 'yatheme') => 'date', __('ID', 'yatheme') => 'ID', __('Author', 'yatheme') => 'author', __('Title', 'yatheme') => 'title', __('Modified', 'yatheme') => 'modified', __('Random', 'yatheme') => 'rand', __('Comment count', 'yatheme') => 'comment_count', __('Menu order', 'yatheme') => 'menu_order'), 'description' => __('Select how to sort retrieved posts. More at %s.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    /////////////////// ya Choose us/////////////////////
    vc_map(array('name' => 'YTC_' . __('Why Choose Us', 'yatheme'), 'base' => 'block_chooseus', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('Display Content Blog Why Choose Us', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('type' => 'attach_images', 'heading' => __('Image', 'yatheme'), 'param_name' => 'image', 'description' => __('', 'yatheme')), array('type' => 'textfield', 'heading' => __('Description', 'yatheme'), 'param_name' => 'description', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
    /////////////////// ya Hot Category/////////////////////
    vc_map(array('name' => 'YTC_' . __('Hot Category', 'yatheme'), 'base' => 'hot_category', 'icon' => 'icon-wpb-ytc', 'category' => __('My shortcodes', 'yatheme'), 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => __('Display Hot Product Category', 'yatheme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Title', 'yatheme'), 'param_name' => 'title', 'description' => __('What text use as a widget title. Leave blank to use default widget title.', 'yatheme')), array('type' => 'checkbox', 'holder' => 'div', 'class' => '', 'heading' => __("Category", "smartaddons"), 'param_name' => "categories", 'value' => $term1, 'description' => __("Select Categories", "smartaddons")), array('type' => 'textfield', 'heading' => __('Extra class name', 'yatheme'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'yatheme')))));
}
Example #21
0
    function form($instance)
    {
        $title = isset($instance['title']) ? $instance['title'] : '';
        $nav_menu = isset($instance['nav_menu']) ? $instance['nav_menu'] : '';
        $menus = wp_get_nav_menus(array('orderby' => 'name'));
        if (!$menus) {
            echo '<p>' . sprintf(__('No menus have been created yet. <a href="%s">Create some</a>.', 'autorent'), admin_url('nav-menus.php')) . '</p>';
            return;
        }
        ?>
		<p>
			<label for="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
"><?php 
        _e('Title:', 'casa');
        ?>
</label>
			<input type="text" class="widefat" id="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('title'));
        ?>
" value="<?php 
        echo esc_attr($title);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo esc_attr($this->get_field_id('nav_menu'));
        ?>
"><?php 
        _e('Select Menu:', 'casa');
        ?>
</label>
			<select id="<?php 
        echo esc_attr($this->get_field_id('nav_menu'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('nav_menu'));
        ?>
">
				<option value="0"><?php 
        _e('&mdash; Select &mdash;', 'casa');
        ?>
</option>
		<?php 
        foreach ($menus as $menu) {
            echo '<option value="' . $menu->term_id . '"' . selected($nav_menu, $menu->term_id, false) . '>' . esc_html($menu->name) . '</option>';
        }
        ?>
			</select>
		</p>
		<?php 
    }
Example #22
0
function ts_shortcodes_menu_options()
{
    $menus = wp_get_nav_menus();
    $menu_array = array('' => __('Choose a menu...', 'ThemeStockyard'));
    foreach ($menus as $menu) {
        $menu_array[$menu->term_id] = $menu->name;
    }
    return $menu_array;
}
Example #23
0
/**
 * Register default menu.
 *
 * @since 1.0.0
 */
function beans_do_register_default_menu()
{
    // Stop here if a menu already exists.
    if (wp_get_nav_menus()) {
        return;
    }
    // Set up default menu.
    wp_update_nav_menu_item(wp_create_nav_menu(__('Navigation', 'beans')), 0, array('menu-item-title' => __('Home', 'beans'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish'));
}
 function tc_alter_wp_customizer_settings($wp_customize)
 {
     //CHANGE BLOGNAME AND BLOGDESCRIPTION TRANSPORT
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     //IF WP VERSION >= 4.3 AND SITE_ICON SETTING EXISTS
     //=> REMOVE CUSTOMIZR FAV ICON CONTROL
     //=> CHANGE SITE ICON DEFAULT WP SECTION TO CUSTOMIZR LOGO SECTION
     global $wp_version;
     if (version_compare($wp_version, '4.3', '>=') && is_object($wp_customize->get_control('site_icon'))) {
         $tc_option_group = TC___::$tc_option_group;
         $wp_customize->remove_control("{$tc_option_group}[tc_fav_upload]");
         //note : the setting is kept because used in the customizer js api to handle the transition between Customizr favicon to WP site icon.
         $wp_customize->get_control('site_icon')->section = 'logo_sec';
         //add a favicon title after the logo upload
         add_action('__after_setting_control', array($this, 'tc_add_favicon_title'));
     }
     //end ALTER SITE ICON
     //CHANGE MENUS PROPERTIES
     $locations = get_registered_nav_menus();
     $menus = wp_get_nav_menus();
     $choices = array('' => __('&mdash; Select &mdash;', 'customizr'));
     foreach ($menus as $menu) {
         $choices[$menu->term_id] = wp_html_excerpt($menu->name, 40, '&hellip;');
     }
     $_priorities = array('main' => 10, 'secondary' => 20);
     //WP only adds the menu(s) settings and controls if the user has created at least one menu.
     //1) if no menus yet, we still want to display the menu picker + add a notice with a link to the admin menu creation panel
     //=> add_setting and add_control for each menu location. Check if they are set first by security
     //2) if user has already created a menu, the settings are already created, we just need to update the controls.
     $_priority = 0;
     //assign new priorities to the menus controls
     foreach ($locations as $location => $description) {
         $menu_setting_id = "nav_menu_locations[{$location}]";
         //create the settings if they don't exist
         //=> in the condition, make sure that the setting has really not been created yet (maybe over secured)
         if (!$menus && !is_object($wp_customize->get_setting($menu_setting_id))) {
             $wp_customize->add_setting($menu_setting_id, array('sanitize_callback' => 'absint', 'theme_supports' => 'menus'));
         }
         //remove the controls if they exists
         if (is_object($wp_customize->get_control($menu_setting_id))) {
             $wp_customize->remove_control($menu_setting_id);
         }
         //replace the controls by our custom controls
         $_control_properties = array('label' => $description, 'section' => 'nav', 'title' => "main" == $location ? __('Assign menus to locations', 'customizr') : false, 'type' => 'select', 'choices' => $choices, 'priority' => isset($_priorities[$location]) ? $_priorities[$location] : $_priority);
         //add a notice property if no menu created yet.
         if (!$menus) {
             //adapt the nav section description for v4.3 (menu in the customizer from now on)
             $_create_menu_link = version_compare($GLOBALS['wp_version'], '4.3', '<') ? admin_url('nav-menus.php') : "javascript:wp.customize.section('nav').container.find('.customize-section-back').trigger('click'); wp.customize.panel('nav_menus').focus();";
             $_control_properties['notice'] = sprintf(__("You haven't created any menu yet. %s or check the %s to learn more about menus.", "customizr"), sprintf('<strong><a href="%1$s" title="%2$s">%2$s</a></strong>', $_create_menu_link, __("Create a new menu now", "customizr")), sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a>', esc_url('codex.wordpress.org/WordPress_Menu_User_Guide'), __("WordPress documentation", "customizr")));
         }
         $wp_customize->add_control(new TC_controls($wp_customize, $menu_setting_id, $_control_properties));
         $_priority = $_priority + 10;
     }
     //foreach
 }
 public function get_menu()
 {
     global $json_api;
     // Make sure we have key/value query vars
     if ($json_api->query->menu_id || $json_api->query->menu_location) {
         function get_nav_items($id)
         {
             global $json_api;
             $menu_output = wp_get_nav_menu_items($id);
             $filtered_items = array_map(function ($el) {
                 $filter = array("id" => $el->ID, "parent_id" => $el->menu_item_parent, "menu_order" => $el->menu_order, "label" => $el->title, "object_type" => $el->object, "object_id" => $el->object == "custom" ? "" : $el->object_id, "url" => $el->object == "custom" ? $el->url : "");
                 return $filter;
             }, $menu_output);
             $output = $json_api->query->dev == "1" ? $menu_output : $filtered_items;
             $count = count($output);
             if ($count == "0") {
                 $json_api->error("The menu you are looking for is empty or does not exist.");
             } else {
                 return array("output" => $output, "count" => $count);
             }
         }
         if ($json_api->query->menu_id) {
             $menuid = $json_api->query->menu_id;
             $menuloc = "";
             $menu_items = get_nav_items($menuid);
         } else {
             if ($json_api->query->menu_location) {
                 $menuloc = $json_api->query->menu_location;
                 $locations = get_registered_nav_menus();
                 $menus = wp_get_nav_menus();
                 $menu_locations = get_nav_menu_locations();
                 if (isset($menu_locations[$menuloc])) {
                     foreach ($menus as $menu) {
                         // If the ID of this menu is the ID associated with the location we're searching for
                         if ($menu->term_id == $menu_locations[$menuloc]) {
                             // This is the correct menu
                             $menuid = $menu->slug;
                             var_dump($menu->slug);
                             // Get the items for this menu
                             $menu_items = get_nav_items($menuid);
                             break;
                         }
                         //else if ($menu->term_id != $menu_locations[ $menuloc ]) {
                         //	$json_api->error("There are no menus set for this location.");
                         //}
                     }
                 } else {
                     $json_api->error("Menu location: '" . $menuloc . "' does not exist");
                 }
             }
         }
         return array("count" => $menu_items["count"], "menu_location" => $menuloc, "menu_id" => $menuid, "menu" => $menu_items["output"]);
     } else {
         $json_api->error("Include the parameter 'menu_id' with an appropriate string value.");
     }
 }
function circleflip_multimenu_sanitize_data($meta_value, $meta_key, $meta_type)
{
    $_valid_nav_menus = wp_get_nav_menus('fields=ids');
    foreach ($meta_value as $location => $menu) {
        if (!in_array($menu, $_valid_nav_menus)) {
            $meta_value[$location] = 0;
        }
    }
    return $meta_value;
}
Example #27
0
 private function elementVerticalMenu()
 {
     $menus = wp_get_nav_menus(array('orderby' => 'name'));
     $option_menu = array('---Select Menu---' => '');
     foreach ($menus as $menu) {
         $option_menu[$menu->name] = $menu->term_id;
     }
     vc_map(array("name" => __("WPO Vertical Menu", $this->textdomain), "base" => "wpo_verticalmenu", "class" => "", "category" => $this->l('WPO Elements'), "params" => array(array("type" => "textfield", "heading" => __("Title", $this->textdomain), "param_name" => "title", "value" => 'Vertical Menu'), array("type" => "dropdown", "heading" => __("Menu", $this->textdomain), "param_name" => "menu", "value" => $option_menu, "admin_label" => true, "description" => __("Select menu.", $this->textdomain)), array("type" => "dropdown", "heading" => __("Position", $this->textdomain), "param_name" => "postion", "value" => array('left' => 'left', 'right' => 'right'), "admin_label" => true, "description" => __("Postion Menu Vertical.", $this->textdomain)), array("type" => "textfield", "heading" => __("Extra class name", $this->textdomain), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", $this->textdomain)))));
     add_shortcode('wpo_verticalmenu', array($this, 'elementVerticalMenuFrontend'));
 }
 /**
  * Add action links to Stream drop row in admin list screen
  *
  * @filter wp_stream_action_links_{connector}
  *
  * @param  array  $links     Previous links registered
  * @param  object $record    Stream record
  *
  * @return array             Action links
  */
 public function action_links($links, $record)
 {
     if ($record->object_id) {
         $menus = wp_get_nav_menus();
         $menu_ids = wp_list_pluck($menus, 'term_id');
         if (in_array($record->object_id, $menu_ids)) {
             $links[esc_html__('Edit Menu', 'stream')] = admin_url('nav-menus.php?action=edit&menu=' . $record->object_id);
         }
     }
     return $links;
 }
function xtreme_get_nav_menus()
{
    $nav_menus = wp_get_nav_menus();
    $menus = array('pages' => __('Pages', XF_TEXTDOMAIN), 'categories' => __('Categories', XF_TEXTDOMAIN));
    if (isset($nav_menus) && !empty($nav_menus)) {
        foreach ($nav_menus as $nav_menu) {
            $menus[$nav_menu->slug] = $nav_menu->name;
        }
    }
    return $menus;
}
function yb_page_menus_save_post($post_id, $post_object)
{
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    if (!isset($_POST['meta_box_nonce']) || !wp_verify_nonce($_POST['meta_box_nonce'], 'yb_page_menus_nonce')) {
        return;
    }
    /* If this is just a revision, don't save in menu */
    if (wp_is_post_revision($post_id)) {
        return;
    }
    /* save the data with update_post_meta */
    $all_menus = wp_get_nav_menus();
    /* save the data with update_post_meta */
    foreach ($all_menus as $menu) {
        $menuID = (int) $menu->term_id;
        if (isset($_POST['nav-menu-group']) && in_array($menu->name, $_POST['nav-menu-group'])) {
            if (!checkMenuForPage($menuID, $post_id)) {
                $itemData = array('menu-item-object-id' => $post_id, 'menu-item-title' => __(get_the_title($post_id)), 'menu-item-url' => get_permalink($post_id), 'menu-item-object' => 'page', 'menu-item-position' => $post_object->menu_order, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish');
                remove_action('save_post', 'yb_page_menus_save_post', 13, 2);
                wp_update_nav_menu_item($menuID, 0, $itemData);
                add_action('save_post', 'yb_page_menus_save_post', 13, 2);
            }
        } else {
            $isInMenu = checkMenuForPage($menuID, $post_id);
            if ($isInMenu) {
                wp_delete_post($isInMenu);
            }
        }
    }
}