Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #951795

    Hi,

    I have a problem with the enfold child. For example I edited the file /js/avia.js regarding the ajax search in widgets. Problem is. when I make the exact same folders within enfold child and put it in there it won’t work. Only when i change the avia.js in the parent theme. But when I do this, i can never update enfold again.

    What do I do wrong? I downloaded the enfold child provided here.

    Kind regards

    #952900

    Hey Mac-TR,

    Please add the following code

    if(!is_admin()) add_action('wp_enqueue_scripts', 'avia_register_child_frontend_scripts', 100);
    function avia_register_child_frontend_scripts()
    {
    	$child_theme_url = get_stylesheet_directory_uri();
    	wp_dequeue_script('avia-default');
    
    	//register js
    	wp_register_script( 'avia-default-child', $child_theme_url.'/js/avia.js', array('jquery'), 1, true);
    	wp_enqueue_script( 'avia-default-child' );
    }

    to get it load from your child theme

    Best regards,
    Basilis

    #953372

    Hi,

    thank you Basilis. If I read the code correctly the part starting with register .js I would have to make with every php or js file I change from the parent theme correct? And i guess you mean to add it into the functions.php of the child?

    • This reply was modified 6 years, 7 months ago by Mac-TR.
    #954204

    Hi,

    Yeap, that is correct.
    That works for the JS files.
    If you need to load shortcodes from the child theme, then you need to use the following

    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;
    }

    Best regards,
    Basilis

    #954942

    Thank you very much. I think I got it. :)

    #954976

    Hi,
    Good to hear, shall we close this then?

    Best regards,
    Mike

    #956551

    Hi,

    yeah you can close it. Thanks again :)

    Also want to say you guys built a wonderful theme with really clean code

    #956777

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    And if there are features that you wish Enfold had, you can request them and vote the requested ones here
    For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Enfold Child doesn't work’ is closed to new replies.