protected function getWPMenus($options = [], $value = 'term_id')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.menu', [], 'wordpressfield');

        // Build options
        $args = array_merge([
            'hide_empty' => false,
            'orderby' => 'none'
        ], $options);

        // Build request
        $menus_obj = wp_get_nav_menus($args);

        // Iterate on menus
        if (!empty($menus_obj)) {
            foreach ($menus_obj as $menu) {
                // For Wordpress version < 3.0
                if (empty($menu->term_id)) {
                    continue;
                }

                // Check value
                $item = !empty($value) && isset($menu->$value) ? $menu->$value : $menu->term_id;

                // Get the id and the name
                $contents[0][$item] = $menu->name;
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPMenus($options = [], $value = 'term_id')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.menu', [], 'wordpressfield');

        // Build options
        $args = array_merge([
            'hide_empty' => false,
            'orderby' => 'none'
        ], $options);

        // Build request
        $menus_obj = wp_get_nav_menus($args);

        // Iterate on menus
        if (!empty($menus_obj)) {
            foreach ($menus_obj as $menu) {
                // For Wordpress version < 3.0
                if (empty($menu->term_id)) {
                    continue;
                }

                // Check value
                $item = !empty($value) && isset($menu->$value) ? $menu->$value : $menu->term_id;

                // Get the id and the name
                $contents[0][$item] = $menu->name;
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPMenus ( $ options = [ ] , $ value = 'term_id' ) { // Build contents $ contents = [ ] ; $ contents [ - 1 ] = Translate :: t ( 'wordpress.choose.menu' , [ ] , 'wordpressfield' ) ; // Build options $ args = array_merge ( [ 'hide_empty' => false , 'orderby' => 'none' ] , $ options ) ; // Build request $ menus_obj = wp_get_nav_menus ( $ args ) ; // Iterate on menus if ( ! empty ( $ menus_obj ) ) { foreach ( $ menus_obj as $ menu ) { // For Wordpress version < 3.0 if ( empty ( $ menu -> term_id ) ) { continue ; } // Check value $ item = ! empty ( $ value ) && isset ( $ menu -> $ value ) ? $ menu -> $ value : $ menu -> term_id ; // Get the id and the name $ contents [ 0 ] [ $ item ] = $ menu -> name ; } } // Return all values in a well formatted way return $ contents ; }
Get WordPress Menus registered.

@uses wp_get_nav_menus()

@param   array  $options     Define options if needed
@param   string $value       Define the value of each select options
@return  array  $wpcontents  Array of WordPress items
Get WordPress Menus registered .