Esempio n. 1
0
/**
 * Load Frontend Styles
 *
 * Enqueues the required styles for the frontend.
 *
 * @since	1.3
 * @return	void
 */
function mdjm_register_styles()
{
    $file = 'mdjm.css';
    $templates_dir = mdjm_get_theme_template_dir_name();
    $css_dir = MDJM_PLUGIN_URL . '/assets/css/';
    $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()) . $templates_dir . $file;
    $parent_theme_style_sheet = trailingslashit(get_template_directory()) . $templates_dir . $file;
    $mdjm_plugin_style_sheet = trailingslashit(mdjm_get_templates_dir()) . $file;
    // Look in the child theme, followed by the parent theme, and finally the MDJM template DIR.
    // Allows users to copy the MDJM stylesheet to their theme DIR and customise.
    if (file_exists($child_theme_style_sheet)) {
        $url = trailingslashit(get_stylesheet_directory_uri()) . $templates_dir . $file;
    } elseif (file_exists($parent_theme_style_sheet)) {
        $url = trailingslashit(get_template_directory_uri()) . $templates_dir . $file;
    } elseif (file_exists($mdjm_plugin_style_sheet) || file_exists($mdjm_plugin_style_sheet)) {
        $url = trailingslashit(mdjm_get_templates_url()) . $file;
    }
    wp_register_style('mdjm-styles', $url, array(), MDJM_VERSION_NUM);
    wp_enqueue_style('mdjm-styles');
    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css');
    wp_enqueue_style('font-awesome');
    wp_register_style('jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css');
    wp_enqueue_style('jquery-ui');
    if (mdjm_is_payment(true)) {
        wp_enqueue_style('dashicons');
    }
}
/**
 * Returns a list of paths to check for template locations
 *
 * @since	1.3
 * @return	mixed|void
 */
function mdjm_get_theme_template_paths()
{
    $template_dir = mdjm_get_theme_template_dir_name();
    $file_paths = array(1 => trailingslashit(get_stylesheet_directory()) . $template_dir, 10 => trailingslashit(get_template_directory()) . $template_dir, 100 => mdjm_get_templates_dir());
    $file_paths = apply_filters('mdjm_template_paths', $file_paths);
    // sort the file paths based on priority
    ksort($file_paths, SORT_NUMERIC);
    return array_map('trailingslashit', $file_paths);
}