Last active
August 22, 2020 15:28
-
-
Save johnbuck/6277503 to your computer and use it in GitHub Desktop.
Register and enqueue Magnific Popup (http://dimsemenov.com/plugins/magnific-popup/) scripts and styles, rather than calling them explicitly in the HEAD or footer. See http://ajtroxell.com/use-magnific-popup-with-wordpress-now/ for instructions on adding Magnific Popup to your WordPress theme or child theme.
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 | |
//Add this to your functions.php file in your theme or child theme | |
add_action('wp_enqueue_scripts', 'enqueue_magnific_popup_styles'); | |
function enqueue_magnific_popup_styles() { | |
wp_register_style( 'magnific_popup_style', get_stylesheet_directory_uri() . '/magnific-popup/magnific-popup.css' ); | |
wp_enqueue_style( 'magnific_popup_style' ); | |
} | |
add_action('wp_enqueue_scripts', 'enqueue_magnific_popup_scripts'); | |
function enqueue_magnific_popup_scripts() { | |
wp_register_script( 'magnific_popup_script', get_stylesheet_directory_uri() . '/magnific-popup/jquery.magnific-popup.js', array( 'jquery' ) ); | |
wp_enqueue_script( 'magnific_popup_script' ); | |
wp_register_script( 'magnific_init_script', get_stylesheet_directory_uri() . '/magnific-popup/jquery.magnific-init.js', array( 'jquery' ) ); | |
wp_enqueue_script( 'magnific_init_script' ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment