Last active
December 10, 2015 20:38
-
-
Save jg314/4489182 to your computer and use it in GitHub Desktop.
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 | |
function add_styles_scripts(){ | |
//Access the global $wp_version variable to see which version of WordPress is installed. | |
global $wp_version; | |
//If the WordPress version is greater than or equal to 3.5, then load the new WordPress color picker. | |
if ( 3.5 <= $wp_version ){ | |
//Both the necessary css and javascript have been registered already by WordPress, so all we have to do is load them with their handle. | |
wp_enqueue_style( 'wp-color-picker' ); | |
wp_enqueue_script( 'wp-color-picker' ); | |
} | |
//If the WordPress version is less than 3.5 load the older farbtasic color picker. | |
else { | |
//As with wp-color-picker the necessary css and javascript have been registered already by WordPress, so all we have to do is load them with their handle. | |
wp_enqueue_style( 'farbtastic' ); | |
wp_enqueue_script( 'farbtastic' ); | |
} | |
//Load our custom javascript file | |
wp_enqueue_script( 'wp-color-picker-settings', plugin_dir_url( __FILE__ ) . 'js/settings.js' ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment