Поддержка Проблемы и решения Visual Composer не видит кастомные элементы

  • Привет всем. Появилась такая проблема: Visual Composer не видит кастомные элементы. Делаю сайт на моем шаблоне, на одном сайте эти элементы работают нормально, на другом их не видно. Версия wp последняя, как и vc. Набор плагинов одинаковый. Настройки одинаковые.
    http://joxi.ru/4Ak3xBgIob1BjA — новый сайт
    http://joxi.ru/nAyzjEvIgVGvGr — старый сайт

    Код одного из кастомных элементов:

    <?php
    
    	/*
    Element Description: AR Custom Title
    */
     
    // Element Class 
    class vcFancyBox extends WPBakeryShortCode {
         
        // Element Init
        function __construct() {
            add_action( 'init', array( $this, 'vc_fancybox_mapping' ) );
            add_shortcode( 'vc_infobox_fancy', array( $this, 'vc_infobox_fancy_html' ) );
        }
         
        // Element Mapping
        public function vc_fancybox_mapping() {
             
            // Stop all if VC is not enabled
            if ( !defined( 'WPB_VC_VERSION' ) ) {
                return;
            }
             
            // Map the block with vc_map()
            vc_map( 
                array(
                    'name' => __('Fancy Title', 'text-domain'),
                    'base' => 'vc_infobox_fancy',
                    'description' => __('Another section title', 'text-domain'), 
                    'category' => __('Ar Elements', 'text-domain'),   
                    'icon' => get_template_directory_uri().'/assets/img/ar-icon.png',            
                    'params' => array(   
                             
                        array(
                            'type' => 'textfield',
                            'class' => 'ar_section_title',
                            'heading' => __( 'Title', 'text-domain' ),
                            'param_name' => 'ar_section_title',
                            'value' => __( '', 'text-domain' ),
                            'description' => __( 'Add your text to title section', 'text-domain' ),
                            'admin_label' => true,
                            'weight' => 0,
                            'group' => 'AR Group',
                        ),  
    					
    					array(
                            'type' => 'dropdown',
                            'class' => 'ar_title_separator_tag',
                            'heading' => __( 'Title Tag', 'text-domain' ),
                            'param_name' => 'ar_title_separator_tag',
                            'value' => array(
    							esc_html__( 'div', 'text-domain' ) => 'div',
    							esc_html__( 'p', 'text-domain' ) => 'p',
    							esc_html__( 'H1', 'text-domain' ) => 'h1',
    							esc_html__( 'H2', 'text-domain' ) => 'h2',
    							esc_html__( 'H3', 'text-domain' ) => 'h3',
    							esc_html__( 'H4', 'text-domain' ) => 'h4',
    							esc_html__( 'H5', 'text-domain' ) => 'h5',
    							esc_html__( 'H6', 'text-domain' ) => 'h6',
    						),
                            'admin_label' => false,
                            'weight' => 0,
                            'group' => 'AR Group',
                        ),
    					
    					array(
                            'type' => 'textfield',
                            'class' => 'ar_section_title',
                            'heading' => __( 'Title Font Size', 'text-domain' ),
                            'param_name' => 'ar_section_title_size',
                            'value' => __( '', 'text-domain' ),
                            'description' => __( 'Example: 18px', 'text-domain' ),
                            'admin_label' => false,
                            'weight' => 0,
                            'group' => 'AR Group',
                        ), 
    					
    					array(
                            'type' => 'textfield',
                            'class' => 'ar_section_title_align',
                            'heading' => __( 'Title aligment', 'text-domain' ),
                            'param_name' => 'ar_section_title_align',
                            'value' => __( '', 'text-domain' ),
                            'description' => __( 'Example: left/right/center', 'text-domain' ),
                            'admin_label' => false,
                            'weight' => 0,
                            'group' => 'AR Group',
                        ), 
    			
    					array(
    					  "type" => "colorpicker",
    					  "class" => "h3",
    					  "heading" => __( "Title Color", "text-domain" ),
    					  "param_name" => "ar_link_color_title",
    					  "value" => '', 
    					  "description" => __( "Choose title color.", "text-domain" ),
                          'admin_label' => false,
                          'group' => 'AR Group',
    					),
    			
    					array(
    					  "type" => "colorpicker",
    					  "class" => "h3",
    					  "heading" => __( "Animation Background", "text-domain" ),
    					  "param_name" => "ar_link_background_title",
    					  "value" => '', 
    					  "description" => __( "Choose title background.", "text-domain" ),
                          'admin_label' => false,
                          'group' => 'AR Group',
    					),
    			
    					array(
    					  "type" => "textfield",
    					  "class" => "h3",
    					  "heading" => __( "Animated Duration", "text-domain" ),
    					  "param_name" => "ar_link_duration",
    					  "value" => '', 
    					  "description" => __( "Enter Animated Duration. Example: 0.3", "text-domain" ),
                          'admin_label' => false,
                          'group' => 'AR Group',
    					),
    			
    					array(
    					  "type" => "textfield",
    					  "class" => "h3",
    					  "heading" => __( "Animated direction", "text-domain" ),
    					  "param_name" => "ar_link_direction",
    					  "value" => '', 
    					  "description" => __( "Example: left/right.", "text-domain" ),
                          'admin_label' => false,
                          'group' => 'AR Group',
    					),
    			
    					array(
    					  "type" => "colorpicker",
    					  "class" => "h3",
    					  "heading" => __( "Title Color on hover", "text-domain" ),
    					  "param_name" => "ar_link_color_title_hover",
    					  "value" => '', 
    					  "description" => __( "Choose title color on hover.", "text-domain" ),
                          'admin_label' => false,
                          'group' => 'AR Group',
    					),
                            
                    ),
                )
            );                                
            
        }
         
         
        // Element HTML
        public function vc_infobox_fancy_html( $atts ) {
             
            // Params extraction
            extract(
                shortcode_atts(
                    array(
                        'ar_section_title'   => '',
                        'ar_section_title_align'   => '',
                        'ar_title_separator_tag'   => '',
                        'ar_link_background_title' => '',
                        'ar_section_title_size' => '',
                        'ar_link_color_title' => '',
                        'ar_link_duration' => '',
                        'ar_link_direction' => '',
                        'ar_link_color_title_hover' => '',
                    ), 
                    $atts
                )
            );
    		
    		$ar_extra_class = str_replace(' ', '', $ar_section_title);
    		$ar_extra_class = mb_strtolower($ar_extra_class);
    		$ar_extra_class = preg_replace('/[^ a-zа-яё\d]/ui', '',$ar_extra_class );
             
            // Fill $html var with data
            $html = '
            <div class="ar_fancy_title_wrapper '.$ar_extra_class.'" style="text-align: '.$ar_section_title_align.';">
                <'.$ar_title_separator_tag.' class="ar_fancy_title" style="font-size: '.$ar_section_title_size.'; color: '.$ar_link_color_title.'; transition: all '.$ar_link_duration.'s ease;"><span class="ar_fancy_title_text">' . $ar_section_title . '</span><span class="ar_title_fancy_box" style="background: '.$ar_link_background_title.'; transition: all '.$ar_link_duration.'s ease; '.$ar_link_direction.': 100%;"></span></'.$ar_title_separator_tag.'>';		
    				
    		$html .= '</div>';
    		$html .= '
    			<script>
    				jQuery(document).ready(function() {
    					jQuery(".ar_fancy_title_wrapper.'.$ar_extra_class.' .ar_title_fancy_box").viewportChecker({
    						classToAdd: "'.$ar_link_direction.'-ar-animate",
    						offset: 100    
    					   });  
    					   
    					jQuery(".ar_fancy_title_wrapper.'.$ar_extra_class.' .ar_fancy_title").viewportChecker({
    						classToAdd: "colored",
    						offset: 100    
    					   });
    				});            
    			</script>
    		';
    		
    		$html .= '
    			<style>
    				
    				.ar_fancy_title_wrapper.'.$ar_extra_class.' .ar_fancy_title.colored {
    					animation: ar_fancy_title_color '.$ar_link_duration.'s linear;		
    					animation-fill-mode: forwards;
    				}
    				
    				.ar_fancy_title_wrapper.'.$ar_extra_class.' .ar_title_fancy_box.'.$ar_link_direction.'-ar-animate {					
    					animation: '.$ar_link_direction.'-ar-animate '.$ar_link_duration.'s linear;			
    					animation-fill-mode: forwards;
    				}
    
    				@keyframes '.$ar_link_direction.'-ar-animate {
    					from{'.$ar_link_direction.': 100%;}
    					to{'.$ar_link_direction.': 0%;}
    				}
    				
    				@keyframes ar_fancy_title_color {
    					from {color: '.$ar_link_color_title.';}
    					to {color: '.$ar_link_color_title_hover.';}
    				}
    			</style>
    		';
             
            return $html;
             
        }
         
    } // End Element Class
     
     
    // Element Class Init
    new vcFancyBox();  
    
    ?>;

    php ошибок нету. В чем может быть трабл? Спасибо.

    • Тема изменена 4 года, 3 месяца назад пользователем pekinessik.
Просмотр 1 ответа (всего 1)
  • Модератор Yui

    (@fierevere)

    永子

    1. для оформления кода есть кнопка code
    2. попробуйте обратиться в поддержку Visual Composer или того продукта (темы) с которым вы его получили правила форума п9

Просмотр 1 ответа (всего 1)
  • Тема «Visual Composer не видит кастомные элементы» закрыта для новых ответов.