Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wdo_tabs_child() {
- if (function_exists("vc_map")) {
- vc_map(array(
- "name" => __("Пункт левого меню", "wdo-tabs"),
- "base" => "wdo_advance_tab_free",
- "as_child" => array('only' => 'wdo_advance_tabs_free'),
- 'as_parent' => array(''),
- 'allowed_container_element' => 'vc_row',
- 'js_view' => 'VcColumnView',
- "icon" => 'extended-custom-icon-wdo icon-wpb-advanced-tab',
- 'params' => array_merge(
- array(
- array(
- 'type' => 'textfield',
- "holder" => "div",
- 'admin_label' => true,
- 'heading' => esc_html__('Название пункта', "wdo-tabs"),
- 'param_name' => 'wdo_tab_title',
- "description" => "Например: Характеристики.",
- ),
- array(
- "type" => "textfield",
- "param_name" => "wdo_tab_style",
- "heading" => __("Состояния пункта", "wdo-tabs"),
- "description" => __("Выберите состояния пункта: Активный или неактивный", "wdo-tabs"),
- ),
- )
- )
- ));
- }
- }
- function wdo_advance_tabs_rendering($atts, $content = null, $tag) {
- preg_match_all('/wdo_tab_title="([^"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE);
- $tab_titles = array();
- if (isset($matches[0])) {
- $tab_titles = $matches[0];
- }
- $tab_title_array = array();
- foreach($tab_titles as $tab) {
- preg_match('/wdo_tab_title="([^"]+)"/i', $tab[0], $tab_matches, PREG_OFFSET_CAPTURE);
- $tab_title_array[] = $tab_matches[1][0];
- }
- $params['wdo_tabs_titles'] = $tab_title_array;
- $uniqid = rand(0, 1000);
- ob_start();
- ?>
- <ul id="sadiya_ul-<?php echo $uniqid ?>" class="nav nav-tabs">
- <?php foreach ($tab_title_array as $tab_title) {
- $words = preg_replace('/[0-9]+/', '', $tab_title);
- echo '<li class="li__'.sanitize_title($words).'">';
- echo '<a data-toggle="tab" class="'.sanitize_title($words).'" href="#tab-'.sanitize_title($tab_title).'">'.$tab_title.'</a>';
- echo '</li>';
- }
- ?>
- </ul>
Add Comment
Please, Sign In to add comment