Мой код:
// Add language dropdown to visual composer settings
if (function_exists('vc_add_param')) {
vc_add_param('vc_row', array(
'type' => 'dropdown',
'heading' => "Language",
'param_name' => 'language',
'value' => array("English", "Russian"),
'description' => __("Select Language", "discprofile"),
'weight' => 1, // default 0 (unsorted, appened to bottom, 1- append to top)
));
}
// Set custom html_template to display data-lang attribute
if (function_exists('vc_map')) {
// setup custom attributes
$attributes = array(
'html_template' => 'vc_templates/vc_row.php'
);
// Update 'vc_row' to include custom vc_row template and remap shortcode
$params = vc_map_update('vc_row', $attributes);
// Remove default vc_row
vc_remove_element('vc_row');
// Remap shortcode with custom template
vc_map($params['vc_row']);
}
vc_add_param() работает, но вторая часть кода выдает следующую ошибку:
( !) Неустранимая ошибка: Неверный объект vc_map. Базовый атрибут требуется в /Users/mike/Sites/Fun/wordpress/web/app/plugins/js_composer/include/helpers/helpers_api.php в строке 26.
Это ресурсы, которые я ранее просматривал:
- https://stackoverflow.com/a/29226825/3602355
- http://mwender.com/adding-html-id-attributes-to-visual-composer-rows-in-the-x-theme/#comment-1170
- https://snippets.khromov.se/change-settings-of-built-in-visual-composer-elements/#comment-22548
Соответствующая документация:
- https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524332 - vc_map()
- https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524310 - vc_map_update()
Любая помощь будет принята с благодарностью.