Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1484879

    on former times i got a child-theme avia-snippet-sticky-header.js on that
    just for erasing that ! isMobile inside line 81:

    if( shrinking && ! isMobile )
    

    since minified js files i have to upload both files and to insert a snippet to load that child-theme file
    can you please set a filter on that. Because it is always the same procedure – and a filter will be much faster.

    #1484972

    Hey Guenter,

    Check ..\enfold\includes\config-enfold\functions-enqueue.php line 242:

    
    add_action( 'wp_enqueue_scripts', 'avia_register_frontend_scripts' );
    

    If you use in your child theme

    
    add_action( 'wp_enqueue_scripts', 'your_register_frontend_scripts', 11 );
    

    you should be able to use in your function

    
    wp_dequeue_script( 'avia-sticky-header' );
    

    and the enqueue your custom script – see line 112ff for conditions

    Or am I missing something ?

    Best regards,
    Günter

    #1484974

    i did it this way with the edited child-theme files
    (just erased the && ! isMobile ):

    function wp_change_sticky_header_script() {
      wp_deregister_script( 'avia-sticky-header' );
    
      $vn = avia_get_theme_version();
      $options = avia_get_option();
      $child_theme_url = get_stylesheet_directory_uri();
    
      $min_js = avia_minify_extension( 'js' );
      //  $min_css = avia_minify_extension( 'css' );  for that js - file not needed to mention here
    
      $condition  = ( isset( $options['header_position'] ) && $options['header_position'] == 'header_top' );
      $condition2 = ( isset( $options['header_sticky'] ) && $options['header_sticky'] == 'header_sticky' ) && $condition;
      avia_enqueue_script_conditionally( $condition2 , 'avia-sticky-header-child', "{$child_theme_url}/js/avia-snippet-sticky-header{$min_js}.js", array('avia-default'), $vn, true);
    }
    add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 );

    but allways to do this on all pages where i like to have a shrinking header on mobile devices too – and to generate allways the minified file from the actual avia-snippet-sticky-header.js file – is a lot of work.

    A filter set by you would be a great time saver here
    using something like this :
    add_filter('avf_shrinking_header_on_mobile', '__return_true');
    😉​ I am of course aware that a filter has no place in a script file. But maybe there is a trick that could regulate it differently.

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