WordPress.org

Ready to get started?Download WordPress

Forums

Events Calendar
Add support for wp_enqueue_scripts (1 post)

  1. ahuggins
    Member
    Posted 2 years ago #

    I have been using this plugin for a little while, I was wondering if it would be possible to get a change made. I would like to add support for wp_enqueue_scripts so that those of us who know how to wp_deregister_script and wp_deregister_style would be able to limit the additional css and js files from loading on every page of our site.

    This would require a change to events-calendar.php, and would look something like this:

    function EventsCalendarFrontScripts() {
    	$ec_thickbox_style_path = get_bloginfo('url').'/wp_includes/js/thickbox/thickbox.css';
    	wp_register_style('ec_thickbox', $ec_thickbox_style_path);
    	wp_enqueue_style('ec_thickbox');
    	$ec_style_path = EVENTSCALENDARCSSURL.'/events-calendar.css';
    	wp_register_style('ec_styles', $ec_style_path);
    	wp_enqueue_style('ec_styles');
    
    }

    And then you would need to add the following line:
    add_action('wp_enqueue_scripts', 'EventsCalendarFrontScripts');

    Doing so would allow the people that want to, prevent the css and other styles from loading if they do not need them. It may be useful to do something similar for the "no_conflict" code, since that probably doesn't need to be loaded on every page of everyone's site. But the other two for sure.

    If you want I can send you the files, or the code above should be enough. Oh and you would be able to delete a bunch of the function EventsCalendarHeaderScript.

    http://wordpress.org/extend/plugins/events-calendar/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic