/** * Add Visual Composer plugin support * * @link texthttp://vc.wpbakery.com/ * * @todo Support for Frontend Editor (VC4+) * * @since 1.0 * @version 1.2.3 * * @access public */ public function visual_composer_support() { //VC 4+ disabling Frontend Editor if (function_exists('vc_disable_frontend')) { vc_disable_frontend(); } //VC additional shortcodes admin interface $vc_shortcodes_admin_tweaks = apply_filters('wmhook_shortcode_' . 'vc_shortcodes_admin_tweaks_file', $this->page_builder_dir . 'visual-composer/visual-composer.php'); require_once $vc_shortcodes_admin_tweaks; //VC setup screen modifications add_filter('vc_settings_tabs', array($this, 'visual_composer_setup')); delete_option('wpb_js_use_custom'); //Disable VC Guide Tour if (function_exists('vc_editor_post_types')) { foreach (vc_editor_post_types() as $post_type) { add_filter('vc_ui-pointers-' . $post_type, '__return_empty_array', 999); } } //VC extending shortcode parameters add_shortcode_param('wm_radio', array($this, 'visual_composer_custom_field_wm_radio')); //Remove default VC elements (only if current theme supports this) if (function_exists('vc_remove_element') && (wma_supports_subfeature('remove_vc_shortcodes') || wma_supports_subfeature('remove-vc-shortcodes')) && class_exists('WPBMap')) { $vc_shortcodes_all = array_keys(WPBMap::getShortCodes()); $vc_shortcodes_keep = array('vc_row', 'vc_row_inner', 'vc_column', 'vc_column_inner', 'vc_raw_html', 'vc_raw_js', 'contact-form-7', 'gravityform', 'layerslider_vc', 'rev_slider_vc'); // Do not remove custom mapped shortcodes via WP admin if (class_exists('Vc_Automap_Model') && is_callable('Vc_Automap_Model::findAll')) { $vc_shortcodes_custom = Vc_Automap_Model::findAll(); foreach ($vc_shortcodes_custom as $shortcode) { $vc_shortcodes_keep[] = $shortcode->tag; } } $vc_shortcodes_keep = apply_filters('wmhook_shortcode_' . 'vc_keep', $vc_shortcodes_keep); $vc_shortcodes_remove = apply_filters('wmhook_shortcode_' . 'vc_remove', array_diff($vc_shortcodes_all, $vc_shortcodes_keep)); //Array check required due to filter applied above if (is_array($vc_shortcodes_remove) && !empty($vc_shortcodes_remove)) { foreach ($vc_shortcodes_remove as $shortcode) { vc_remove_element($shortcode); } } } //Add custom VC elements if (function_exists('vc_map') && !empty(self::$codes['vc_plugin'])) { ksort(self::$codes['vc_plugin']); foreach (self::$codes['vc_plugin'] as $shortcode) { //simple validation (as of http://kb.wpbakery.com/index.php?title=Vc_map, the below 2 parameters are required) if (!isset($shortcode['name']) || !isset($shortcode['base'])) { continue; } //sort shortcode parameters array if (isset($shortcode['params'])) { ksort($shortcode['params']); } // Fix required for Visual Composer 4.5.2+ $shortcode['params'] = array_values($shortcode['params']); vc_map($shortcode); } } }
public static function map() { $shortcodes = Vc_Automap_Model::findAll(); foreach ($shortcodes as $shortcode) { vc_map(array("name" => $shortcode->name, "base" => $shortcode->tag, "category" => vc_atm_build_categories_array($shortcode->category), "description" => $shortcode->description, "params" => vc_atm_build_params_array($shortcode->params), "show_settings_on_create" => !empty($shortcode->params), "atm" => true, "icon" => 'icon-wpb-atm')); } }
/** * */ public static function map() { $shortcodes = Vc_Automap_Model::findAll(); foreach ($shortcodes as $shortcode) { vc_map(array('name' => $shortcode->name, 'base' => $shortcode->tag, 'category' => vc_atm_build_categories_array($shortcode->category), 'description' => $shortcode->description, 'params' => vc_atm_build_params_array($shortcode->params), 'show_settings_on_create' => !empty($shortcode->params), 'atm' => true, 'icon' => 'icon-wpb-atm')); } }