Plugin Directory

Changeset 1260279


Ignore:
Timestamp:
10/06/2015 10:04:01 AM (10 years ago)
Author:
shockware
Message:

Add ability to set custom theme from wp theme

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contact-form-7-datepicker/trunk/contact-form-7-datepicker.php

    r1260278 r1260279  
    118118
    119119    public static function enqueue_css() {
    120         $theme = get_option('cf7dp_ui_theme');
     120        $theme = apply_filters('cf7dp_ui_theme', get_option('cf7dp_ui_theme'));
    121121
    122122        if (! is_admin() && $theme == 'disabled')
     
    125125        $proto = is_ssl() ? 'https' : 'http';
    126126
    127         wp_enqueue_style(
    128             'jquery-ui-theme',
    129             $proto . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::JQUERYUI_VERSION . '/themes/' . $theme . '/jquery-ui.min.css',
    130             '',
    131             self::JQUERYUI_VERSION,
    132             'all'
    133         );
     127        $custom_themes = (array)apply_filters('cf7dp_custom_ui_themes', array());
     128
     129        if (! is_admin() && ! empty($custom_themes) && array_key_exists($theme, $custom_themes)) {
     130            $theme_css_uri = $custom_themes[$theme];
     131
     132            wp_enqueue_style(
     133                'jquery-ui-theme',
     134                get_stylesheet_directory_uri() . '/' . ltrim($theme_css_uri, '/'),
     135                '',
     136                self::JQUERYUI_VERSION,
     137                'all'
     138            );
     139        } else {
     140            wp_enqueue_style(
     141                'jquery-ui-theme',
     142                $proto . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::JQUERYUI_VERSION . '/themes/' . $theme . '/jquery-ui.min.css',
     143                '',
     144                self::JQUERYUI_VERSION,
     145                'all'
     146            );
     147        }
    134148
    135149        wp_enqueue_style(
Note: See TracChangeset for help on using the changeset viewer.