WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: Events Calendar] JS and CSS loaded in every page (3 posts)

  1. ide79
    Member
    Posted 4 years ago #

    Is there a way to prevent Events calendar JS and CSS files to be loaded in every page? (wp_head)

    4 HTTP requests (JS and CSS) in every page and lots of KB wasted

    Have a large calendar just in one page.

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

  2. Michael Fields
    Themer
    Posted 4 years ago #

    On (or around) line 200 of events-calendar.php you will find a line of code that looks like this:

    if(isset($_GET['page']) && strstr($_GET['page'], 'events-calendar')) {

    Please try the following code instead - you will need to replace 999 with your events page's ID:

    if( is_page( 999 ) ) {

    Please note that this is considered "hacking" the plugin and you will need to repeat this if you ever decide to upgrade the plugin.

    Hope this helps,
    -Mike

  3. ide79
    Member
    Posted 4 years ago #

    Thanks for the help, but it did not do the trick.

    I am using Events-calendar 6.6-beta
    and the pages are in a Local testing server

    At around line 200 there is
    if(isset($_GET['page']) && strstr($_GET['page'], 'events-calendar')) {
    That line is in the function EventsCalendarManagmentINIT()

    Seems to me that the js and the css comes from events-calendar.php around line 160

    function EventsCalendarINIT() {
    $inadmin = strstr[$svr_uri, 'wp-admin');
    if (!$inadmin) {
    wp_enque_scirpt('....');
    }

    Is it possible to call if( is_page(999)) from events-calendar.php ?

    Tried if ((!$inadmin) && (is_page(999)) {

Topic Closed

This topic has been closed to new replies.

About this Topic