WordPress.org

Support

Support » Plugins and Hacks » The Events Calendar » [Plugin: The Events Calendar] Override events.css

[Plugin: The Events Calendar] Override events.css

  • 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’ );
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: The Events Calendar] Override events.css’ is closed to new replies.
Skip to toolbar