The Bridge Theme for WordPress – Why Your Video Is Not Playing In Lightbox
Did your video lightbox suddenly stop playing videos? Frustrating! I can’t tell you how many times I’ve had to fix this issue for my clients. Qode has a post about it, but their fix is temporary. Each time the Bridge parent theme gets updated, you have to fix it again. Here is a link to their post: https://helpcenter.qodeinteractive.com/hc/en-us/articles/360002326298-What-To-Do-If-Your-Video-Is-Not-Showing-In-Lightbox
If you’ve looked at Qode’s solution you know that currently there is a line of code that comes from WPBakery that causes a conflict.
The Permanent Fix
After some research and testing, I found that you can permanently fix this issue by changing the child theme’s “functions.php” file, located under Appearance/Theme Editor.
A WORD OF CAUTION: Be sure to create a backup of your functions.php file before beginning to work on it. One way to do that is to copy all of the code from inside the functions.php file into a text editor and save it! That way you can copy and paste it back in there if anything goes wrong.
Add this code to the bottom of your child theme’s functions.php file:
add_action(‘wp_enqueue_scripts’, ‘wpse26822_script_fix’, 100);
function wpse26822_script_fix()
{
wp_dequeue_script(‘prettyphoto’);
wp_enqueue_script(“bridgeprettyphoto”, QODE_ROOT.”/js/plugins/jquery.prettyPhoto.js”,array(‘jquery’),false,true);
}
By inserting that code into the child theme’s “functions.php” file, your video lightbox will continue to function properly the next time Qode pushes out an update to WPBakery.