Last active
April 10, 2016 20:51
-
-
Save tyxla/f15f293293a961569d81f65cc4452cc1 to your computer and use it in GitHub Desktop.
WP Hydra and Media Grid Wordpress Responsive Portfolio - compatibility fix
This file contains 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: Media Grid Fix | |
Version: 1.0 | |
*/ | |
// global script enqueuing | |
remove_action('init', 'mg_global_scripts'); | |
add_action('init', 'my_mg_global_scripts'); | |
function my_mg_global_scripts() { | |
$mg_url = plugins_url( 'media-grid' ); | |
wp_enqueue_script('jquery'); | |
// force latest fontawesome version | |
wp_dequeue_style('fontawesome'); | |
wp_enqueue_style('fontawesome', $mg_url . '/css/font-awesome/css/font-awesome.min.css', 999, '4.3.0'); | |
// admin css & js | |
if (is_admin()) { | |
mg_register_scripts(); | |
wp_enqueue_style('mg_admin', $mg_url . '/css/admin.css', 999, '4.0.5'); | |
// chosen | |
wp_enqueue_style( 'lcwp-chosen-style', $mg_url.'/js/chosen/chosen.css', 999); | |
// lcweb switch | |
wp_enqueue_style( 'lc-switch', $mg_url.'/js/lc-switch/lc_switch.css', 999); | |
// colorpicker | |
wp_enqueue_style( 'mg-colpick', $mg_url.'/js/colpick/css/colpick.css', 999); | |
// LCWP jQuery ui | |
wp_enqueue_style( 'lcwp-ui-theme', $mg_url.'/css/ui-wp-theme/jquery-ui-1.8.17.custom.css', 999); | |
wp_enqueue_script('jquery-ui-sortable'); | |
wp_enqueue_script('jquery-ui-tabs' ); | |
// lightbox and thickbox | |
wp_enqueue_style('thickbox'); | |
wp_enqueue_script('media-upload'); | |
wp_enqueue_script('thickbox'); | |
} | |
if (!is_admin()) { | |
// frontent JS on header or footer | |
if(get_option('mg_js_head') != '1') { | |
wp_enqueue_script('mg-frontend-js', $mg_url.'/js/frontend.js', 100, '4.0.5', true); | |
} else { | |
wp_enqueue_script('mg-frontend-js', $mg_url.'/js/frontend.js', 900, '4.0.5'); | |
} | |
// frontend css | |
if(!get_option('mg_inline_css') && !get_option('mg_force_inline_css')) { | |
wp_enqueue_style('mg-custom-css', $mg_url. '/css/custom.css', 100, '4.0.5'); | |
} | |
else {add_action('wp_head', 'mg_inline_css', 989);} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment