JavaScript Disaster
-
‘Good’ plug-in, but the JavaScript is set to load on EVERY page on the website. How about something like `function public_enqueue() {
if( is_page(‘events’) ) { //Only load on the page “events”
//Scripts
wp_enqueue_script(‘events-manager’, plugins_url(‘includes/js/events-manager.js’,__FILE__), array(‘jquery’, ‘jquery-ui-core’,’jquery-ui-widget’,’jquery-ui-position’,’jquery-ui-sortable’,’jquery-ui-datepicker’,’jquery-ui-autocomplete’,’jquery-ui-dialog’)); //jQuery will load as dependency
//Styles
wp_enqueue_style(‘events-manager’, plugins_url(‘includes/css/events_manager.css’,__FILE__)); //main css
}
}`
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘JavaScript Disaster’ is closed to new replies.