WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Override events.css (3 posts)

  1. blt4
    Member
    Posted 3 years ago #

    When a child theme overrides events.css, The Events Calendar looks for the stylesheet in the parent theme.

    Could you possibly change the "loadDomainStylesScripts" function in the-events-calendar.class.php to look something like:

    public function loadDomainStylesScripts() {
    load_plugin_textdomain( $this->pluginDomain, false, basename(dirname(__FILE__)) . '/lang/');
    $eventsURL = trailingslashit( WP_PLUGIN_URL ) . trailingslashit( plugin_basename( dirname( __FILE__ ) ) ) . 'resources/';
    wp_enqueue_script('sp-events-calendar-script', $eventsURL.'events.js', array('jquery') );
    if( $filename = locate_template( array('events/events.css') ) ) {
    $templateArray = explode( '/', $filename );
    $themeName = $templateArray[count($templateArray)-3];
    wp_enqueue_style('sp-events-calendar-style', WP_CONTENT_URL.'/themes/'.$themeName.'/events/events.css', array(), The_Events_Calendar::VERSION, 'screen' );
    } else wp_enqueue_style('sp-events-calendar-style', $eventsURL.'events.css', array(), The_Events_Calendar::VERSION, 'screen' );
    }

  2. monodistortion
    Member
    Posted 3 years ago #

    I just ran into this same bug in version Version 1.6.4 of the-events-calendar.

    To get the events.css file to load from the correct location in the child theme folder like themes/child_theme/events/events.css you'll need to change one line in the file the-events-calendar.class.php. This file will be overwritten when you upgrade the plugin so make a backup.

    Find the function loadDomainStylesScripts and change the line:

    $templateArray = explode( '/', TEMPLATEPATH );
    

    to:

    $templateArray = explode( '/', STYLESHEETPATH );
    

    This fix works in child themes and normal non-child themes.

  3. sheclimber
    Member
    Posted 3 years ago #

    I just followed the advise above:

    Find the function loadDomainStylesScripts and change the line:

    $templateArray = explode( '/', TEMPLATEPATH );

    to:

    $templateArray = explode( '/', STYLESHEETPATH );

    But it is still looking for events.css in the parent theme (twentyten) instead of my current child theme of twentyten. Any suggestions?

    I'm using version 1.6.5

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic