Support » Plugins » WP Events Calendar jQuery conflicts

  • Resolved jamesbrosher

    (@jamesbrosher)


    If you are using the WP Events Calendar and find that it conflicts with every known plugin imaginable, I might have a solution for you.

    The biggest issue with the plugin is that it loads a jQuery script on every page by default, regardless of whether you have a calendar on that page. In my case, I just needed the calendar to load on one page.

    The way around this is to write a conditional statement in php so that the jQuery only loads on pages where you have a calendar. (Sorry, but this essentially kills the sidebar widget.)

    Find the function below in events-calendar.php and wrap the jQuery portion of the code below in “if (is_page(’17’)) {“. Below that put in a “else { }”. (Or just copy and paste this code over the existing code in your plugin.) Change 17 to the page ID number where your calendar is located.

    function EventsCalendarHeaderScript() {
    ?>
    <!-- Start Of Script Generated By Events-Calendar [Luke Howell | www.lukehowell.com] and [R. MALKA | www.heirem.fr] -->
    <!-- More information at http://wp-eventscalendar.com. -->
    <link type="text/css" rel="stylesheet" href="<?php bloginfo('wpurl');?>/wp-includes/js/thickbox/thickbox.css" />
    <link type="text/css" rel="stylesheet" href="<?php echo EVENTSCALENDARCSSURL;?>/events-calendar.css" />
    
    <?php
    
    	if (is_page('17')) {
    
    	require_once(ABSPATH . 'wp-admin/includes/admin.php');
       // jQuery DOM extreme protection management
    	$options = get_option('optionsEventsCalendar');
       echo ' <script type="text/javascript">',"\n\t";
       echo '// <![CDATA[',"\n\t";
       echo 'var ecd = {};',"\n\t";
       echo 'ecd.jq = jQuery.noConflict('.$options['jqueryextremstatus'].');',"\n\t";
       echo '//]]>',"\n";
       echo ' </script>',"\n";
    	echo "<!-- End Of Script Generated By Events-Calendar - ".EVENTSCALENDARVERS." -->\n";
    	}
    
    	else {
    
    	}
    
    }
  • The topic ‘WP Events Calendar jQuery conflicts’ is closed to new replies.