Last active
March 30, 2019 01:12
-
-
Save helgatheviking/bc372086690e5d315e7aced3aeb1062b to your computer and use it in GitHub Desktop.
Add support for Claue theme's version of quickview.
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: WooCommerce Name Your Price Compatibility for Claue Theme | |
* Plugin URI: http://www.woocommerce.com/products/name-your-price/ | |
* Description: Add support for Claue theme's version of quickview. | |
* Version: 1.0.0.beta.1 | |
* Author: Kathy Darling | |
* Author URI: http://kathyisawesome.com/ | |
* | |
* Copyright: © 2019 Kathy Darling | |
* License: GNU General Public License v3.0 | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
/** | |
* Load the NYP scripts on all pages. | |
*/ | |
function kia_load_nyp_scripts_everywhere() { | |
if( function_exists( 'WC_Name_Your_Price' ) ){ | |
WC_Name_Your_Price()->display->nyp_scripts(); | |
add_action( 'wp_print_footer_scripts', 'kia_initialize_nyp_scripts' ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'kia_load_nyp_scripts_everywhere', 30 ); | |
/** | |
* Initialize NYP when Magnific popup window item is opened. | |
*/ | |
function kia_initialize_nyp_scripts() { ?> | |
<script type="text/javascript"> | |
jQuery( document ).on( 'mfpOpen', function() { | |
jQuery( 'body' ).trigger( 'quick-view-displayed' ); | |
} ); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment