Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #242607

    Hi, I’ve created some new elements for visual composer based on portfolio element. I would like to know how I can add this elements through a child theme, son in every update, I won’t loose the changes that I made.

    Thank you.

    #242618

    Hi Pedro!

    If you want to overwrite an existing shortcode create a “shortcodes” folder within the child theme directory, then copy the /wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/masonry_entries.php into the child theme “shortcodes” folder and modify the php code. At least add following code into the child theme functions.php file

    
    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
    	$template_url = get_stylesheet_directory();
        	array_unshift($paths, $template_url.'/shortcodes/');
    
    	return $paths;
    }
    

    This code will make sure the the shortcode file of the child theme is loaded first and you can overwrite the parent theme slideshow shortcode file with the child theme.
    Best regards,
    Peter

    #242935

    Thanks a lot. It works perfectly.

    I have another question, it is also possible to hook some more options into the admin panel of the theme from a child theme? I mean, edit something from the register-admin-options.php file.

    Thanks

    #243206

    Hey!

    Yes. Use this code:

    
    add_filter('avf_option_page_init', 'add_option_tab'), 10, 1); //Adds option page to Enfold theme option panel
        function add_option_tab($avia_pages)
        {
            $avia_pages[] = array( 'slug' => 'mysettings', 'parent'=>'avia', 'icon'=>"hammer_screwdriver.png", 'title'=>__('My Tab','avia_framework'));
            return $avia_pages;
        }
    

    to add a new option tab and this code:

    
    add_filter('avf_option_page_data_init', 'add_option_to_settings_page', 10, 1); //Adds options to the "Custom Post Types" option page
        function add_option_to_settings_page($avia_elements)
        {
            $avia_elements[] =  array(
                        "slug"  => "mysettings",
                        "name"  => __("Custom Message",'avia_framework'),
                        "desc"  => __("Please enter the message that you would like to dispay to your visitors.",'avia_framework'),
                        "id"    => "message",
                        "type"  => "textarea",
                        "std"   => ""
                        );
    
            return $avia_elements;
        }
    

    to add new options to this tab. If you want to add options to an existing tab replace “mysettings” with the slug of the tab you want to modify.

    Cheers!
    Peter

    #243253

    Thanks for your help Dude ;)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Add elements to visual composer’ is closed to new replies.