Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #284739

    Hi!

    i have slightly modified the ajax-search. But at the moment all my changes are in the original avia.js and this is not update-save.

    Could you please provide a code snippet – if possible – how i could overwrite methods of the AviaAjaxSearch-Methods:

    – bind_events
    – try_search and
    – do_search

    by an external JS and so i can let the avia.js be untouched.

    thanks a lot,

    Christian

    #284813

    Hey mrdonthave!

    Afaik you can’t overwrite the methods but you can load a custom version of avia.js from the child theme folder (which will be used instead of the original (parent theme) avia.js. Insert this 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' );
    }
    

    into the child theme functions.php file and place the custom avia.js file into the child theme folder (wp-content/themes/enfold-child/js/avia.js).

    Best regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.