Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Last active March 30, 2019 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helgatheviking/bc372086690e5d315e7aced3aeb1062b to your computer and use it in GitHub Desktop.
Save helgatheviking/bc372086690e5d315e7aced3aeb1062b to your computer and use it in GitHub Desktop.
Add support for Claue theme's version of quickview.
<?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