Last active
March 31, 2022 14:44
-
-
Save foliovision/50853eebaa6f8a68c7dc60f5b798d7b2 to your computer and use it in GitHub Desktop.
FV Player - fix for MemberPress Courses as it doesn't run with wp_footer()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: FV Player - MemberPress Courses fix | |
* Version: 0.2 | |
* Description: Since memberpress-courses/app/views/classroom/courses_footer.php doesn't contain wp_footer hook we have to provide an alternative way of loading FV Player scripts. Here's another description of the issue: https://blog.calendarscripts.info/watu-watupro-and-memberpress-temporary-solution-to-an-issue/ | |
* Author: Foliovision | |
* Author URI: https://foliovision.com | |
*/ | |
add_action('mpcs_courses_footer', function() { | |
// Load the CSS in a forceful way | |
global $fv_fp, $fv_wp_flowplayer_ver; | |
$sURL = FV_FP_RELATIVE_PATH.'/css/flowplayer.css'; | |
echo "<link rel='stylesheet' id='fv_flowplayer-css' href='".esc_attr($sURL)."?ver=".$fv_wp_flowplayer_ver."' type='text/css' media='all' />\n"; | |
if( method_exists( $fv_fp, 'css_generate' ) ) { | |
$fv_fp->css_generate(false); | |
} | |
// Enqueue FV Player scripts | |
flowplayer_prepare_scripts(); | |
flowplayer_display_scripts(); | |
// Not ideal, but will load assets of all FV Player extensions | |
do_action('fv_player_extensions_admin_load_assets'); | |
// Load all the enqueued scripts | |
do_action( 'wp_print_footer_scripts' ); | |
}, 9 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment