Compatibility with Visual Composer plugin

Visual Composer is a very popular premium plugin used for building page layouts. Unfortunately, at the time of writing this article, VC still uses an older version of waypoints.jquery library. Our themes use the same library as well, but since VC is loaded first, wphoot themes skips loading the updated waypoints library bundled in the theme.

Due to this, you will notice that the sticky header feature in our themes simply wont work.

To solve this, simply upload and activate Hoot VisualComposer plugin.

* Alternately, if you are using a child theme, instead of adding the above plugin, you can simply add the php code below to the child theme’s functions.php file.

add_action( 'wp_enqueue_scripts', 'hoot_child_enqueue_wp_styles_scripts', 101 );
 function hoot_child_enqueue_wp_styles_scripts() {
     if ( function_exists( 'hoot_locate_script' ) && defined( 'HOOT_JS' ) ) :
         $wpt_uri = hoot_locate_script( trailingslashit( HOOT_JS ) . 'jquery.waypoints' );
         $stc_uri = hoot_locate_script( trailingslashit( HOOT_JS ) . 'sticky' );
     elseif ( function_exists( 'hoot_locate_script' ) && function_exists( 'hoot_data' ) && !empty( hoot_data()->premium_liburi ) ) :
         $wpt_uri = hoot_locate_script( hoot_data()->premium_liburi . 'js/jquery.waypoints' );
         $stc_uri = hoot_locate_script( hoot_data()->premium_liburi . 'js/jquery.waypoints.sticky' );
     elseif ( function_exists( 'hybridextend_locate_script' ) && defined( 'HYBRIDEXTEND_JS' ) ) :
         $wpt_uri = hybridextend_locate_script( HYBRIDEXTEND_JS . 'jquery.waypoints' );
         $stc_uri = hybridextend_locate_script( HYBRIDEXTEND_JS . 'sticky' );
     endif;
     if ( !empty( $wpt_uri ) ) {
         wp_deregister_script( 'waypoints' );
         wp_dequeue_script( 'waypoints-sticky' );
         wp_enqueue_script( 'waypoints', $wpt_uri, array( 'jquery' ), '3.1.0', true );
         wp_enqueue_script( 'waypoints-sticky', $stc_uri, array( 'jquery', 'waypoints' ), '3.1.0', true );
     }
 }