Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created May 7, 2013 17:50
Show Gist options
  • Select an option

  • Save joshfeck/5534621 to your computer and use it in GitHub Desktop.

Select an option

Save joshfeck/5534621 to your computer and use it in GitHub Desktop.
a function that loads up a themeroller stylesheet for the calendar. Can be placed in a theme's functions.php file
<?php
add_action('wp_enqueue_scripts', 'add_calendar_themeroller_stylesheet');
function add_calendar_themeroller_stylesheet() {
global $org_options;
global $espresso_calendar;
$page_array = explode(',', $espresso_calendar['calendar_pages']);
//print_r($page_array);
if ($espresso_calendar['calendar_pages'] != 0) {
if (!is_page($page_array)) {
return;
}
}
//Define the path to the ThemeRoller files
if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "themeroller/index.php")) {
$themeroller_style_path = EVENT_ESPRESSO_UPLOAD_URL . 'themeroller/';
} else {
$themeroller_style_path = EVENT_ESPRESSO_PLUGINFULLURL . 'templates/css/themeroller/';
}
//Register the ThemeRoller styles
if !is_admin()) {
//Load the themeroller base style sheet
//If the themeroller-base.css is in the uploads folder, then we will use it instead of the one in the core
if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'themeroller/themeroller-base.css')) {
wp_register_style('espresso_themeroller_base', $themeroller_style_path . 'themeroller-base.css');
} else {
wp_register_style('espresso_themeroller_base', EVENT_ESPRESSO_PLUGINFULLURL . 'templates/css/themeroller/themeroller-base.css');
}
wp_enqueue_style('espresso_themeroller_base');
//Load the smoothness style by default<br />
if (!isset($org_options['themeroller']['themeroller_style']) || empty($org_options['themeroller']['themeroller_style']) || $org_options['themeroller']['themeroller_style'] == 'N' ) {
$org_options['themeroller']['themeroller_style'] = 'smoothness';
}
//Load the selected themeroller style
wp_register_style('espresso_themeroller', $themeroller_style_path . $org_options['themeroller']['themeroller_style'] . '/style.css');
wp_enqueue_style('espresso_themeroller');
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment