Sure thing…
Here’s where I define the constant in the main plugin file:
// Define a couple of constants
define('SEXY_OPTIONS','SexyBookmarks');
define('SEXY_vNum','3.1');
And here is where I use wp_enque_script() and wp_enqueue_style() in the public.php file which handles everything seen on the front end:
// Write the <head> code only on pages that the menu is set to display
function sexy_publicStyles() {
global $sexy_plugopts, $post, $sexy_custom_sprite;
// If custom field is set, do not display sexybookmarks
if(get_post_meta($post->ID, 'Hide SexyBookmarks')) {
echo "\n\n".'<!-- '.__('SexyBookmarks has been disabled on this page', 'sexybookmarks').' -->'."\n\n";
} else {
//custom mods rule over custom css
$surl = (!is_null($sexy_custom_sprite)) ? $sexy_custom_sprite : SEXY_PLUGPATH.'css/style.css'; // If custom css, generated by sprite
$surl = ($sexy_plugopts['custom-mods'] == 'yes') ? WP_CONTENT_URL.'/sexy-mods/css/style.css' : $surl; // If custom mods option is selected, pull files from new location
wp_enqueue_style('sexy-bookmarks', $surl, false, SEXY_vNum, 'all');
}
}
function sexy_publicScripts() {
global $sexy_plugopts, $post;
if (($sexy_plugopts['expand'] || $sexy_plugopts['autocenter'] || $sexy_plugopts['targetopt']=='_blank') && !get_post_meta($post->ID, 'Hide SexyBookmarks')) { // If any javascript dependent options are selected, load the scripts
$surl = ($sexy_plugopts['custom-mods'] == 'yes') ? WP_CONTENT_URL.'/sexy-mods/' : SEXY_PLUGPATH; // If custom mods option is selected, pull files from new location
$jquery = ($sexy_plugopts['doNotIncludeJQuery'] != '1') ? array('jquery') : array(); // If jQuery compatibility fix is not selected, go ahead and load jQuery
$infooter = ($sexy_plugopts['scriptInFooter'] == '1') ? true : false;
wp_enqueue_script('sexy-bookmarks-public-js', $surl.'js/sexy-bookmarks-public.js', $jquery, SEXY_vNum, $infooter);
}
}
add_action('wp_print_styles', 'sexy_publicStyles');
add_action('wp_print_scripts', 'sexy_publicScripts');
add_filter('the_content', 'sexy_position_menu');