コード例 #1
0
ファイル: skinning.php プロジェクト: pab44/pab44
 function wm_theme_customizer_css()
 {
     // Helper variables
     $output = wm_custom_styles();
     // Output
     if ($output) {
         wp_add_inline_style('stylesheet-global', apply_filters('wmhook_esc_css', $output));
     }
 }
コード例 #2
0
 function wm_theme_customizer_css()
 {
     //Helper variables
     $output = wm_custom_styles();
     //Output
     if ($output) {
         echo apply_filters('wmhook_wm_theme_customizer_css_output', '<style type="text/css" id="' . WM_THEME_SHORTNAME . '-customizer-styles">' . "\r\n" . $output . "\r\n" . '</style>');
     }
 }
コード例 #3
0
ファイル: customizer.php プロジェクト: bluefire42/modern
 function wm_custom_styles_cache()
 {
     //Set cache, do not return
     wm_custom_styles(true, false);
 }
コード例 #4
0
ファイル: setup.php プロジェクト: jonstonnguyen/auberge
 function wm_enqueue_assets()
 {
     //Helper variables
     $enqueue_styles = $enqueue_scripts = array();
     $custom_styles = wm_custom_styles();
     $inline_styles_handle = wp_style_is('wm-colors', 'registered') ? 'wm-colors' : 'wm-stylesheet';
     $inline_styles_handle = apply_filters('wmhook_wm_enqueue_assets_inline_styles_handle', $inline_styles_handle);
     /**
      * Styles
      */
     //Google Fonts
     if (wm_google_fonts_url()) {
         $enqueue_styles[] = 'wm-google-fonts';
     }
     //Food menu icon for search results
     if ((is_search() || is_archive()) && defined('JETPACK__VERSION') && class_exists('Nova_Restaurant')) {
         wp_enqueue_style('nova-font', plugins_url('css/nova-font.css', JETPACK__PLUGIN_DIR . 'modules/custom-post-types/nova.php'), array(), JETPACK__VERSION);
     }
     //Banner slider
     if (is_front_page() && wm_has_banner_posts(2)) {
         $enqueue_styles[] = 'wm-slick';
     }
     //Main
     $enqueue_styles[] = 'wm-stylesheet';
     //Colors
     if ('wm-colors' === $inline_styles_handle) {
         $enqueue_styles[] = 'wm-colors';
     }
     $enqueue_styles = apply_filters('wmhook_wm_enqueue_assets_enqueue_styles', $enqueue_styles);
     foreach ($enqueue_styles as $handle) {
         wp_enqueue_style($handle);
     }
     /**
      * Styles - inline
      */
     //Customizer setup custom styles
     if ($custom_styles) {
         wp_add_inline_style($inline_styles_handle, "\r\n" . apply_filters('wmhook_esc_css', $custom_styles) . "\r\n");
     }
     //Custom styles set in post/page 'custom-css' custom field
     if (is_singular() && ($output = get_post_meta(get_the_ID(), 'custom_css', true))) {
         $output = apply_filters('wmhook_wm_enqueue_assets_styles_inline_singular', "\r\n\r\n/* Custom singular styles */\r\n" . $output . "\r\n");
         wp_add_inline_style($inline_styles_handle, apply_filters('wmhook_esc_css', $output) . "\r\n");
     }
     //Beaver Builder support
     if (isset($_GET['fl_builder'])) {
         $output = apply_filters('wmhook_wm_enqueue_assets_styles_inline_beaver_builder', "\r\n.fl-builder-lightbox .fl-lightbox { width: 720px; } .fl-builder-settings-tab { width: 100%; }\r\n");
         wp_add_inline_style($inline_styles_handle, apply_filters('wmhook_esc_css', $output) . "\r\n");
     }
     /**
      * Scripts
      */
     //Masonry script (in footer and in archives)
     $footer_widgets = wp_get_sidebars_widgets();
     if (is_array($footer_widgets) && isset($footer_widgets['footer']) && count($footer_widgets['footer']) > absint(apply_filters('wmhook_widgets_columns', 3, 'footer')) || is_archive() && !is_tax('nova_menu') || is_front_page() || is_home() || is_search()) {
         $enqueue_scripts[] = 'jquery-masonry';
     }
     //Banner slider
     if (is_front_page() && wm_has_banner_posts(2)) {
         $enqueue_scripts[] = 'wm-slick';
     }
     //Global theme scripts
     $enqueue_scripts[] = 'wm-scripts-global';
     //Skip link focus fix
     $enqueue_scripts[] = 'wm-skip-link-focus-fix';
     $enqueue_scripts = apply_filters('wmhook_wm_enqueue_assets_enqueue_scripts', $enqueue_scripts);
     foreach ($enqueue_scripts as $handle) {
         wp_enqueue_script($handle);
     }
     /**
      * Scripts - inline
      */
     $scripts_inline = apply_filters('wmhook_wm_enqueue_assets_scripts_inline', array('text_menu_group_nav' => _x('&uarr; Menu sections', 'Back to food menu sections selectors button title.', 'wm_domain')));
     wp_localize_script('wm-scripts-global', '$scriptsInline', $scripts_inline);
 }
コード例 #5
0
        echo "\r\n\r\n\r\n/* {$css_file_path} */\r\n\r\n";
        if (file_exists($css_file_path)) {
            require $css_file_path;
        }
    } else {
        $css_file_path = 'assets/css/' . $css_file_name . '.css';
        //Print file URL at the beginning of its content
        echo "\r\n\r\n\r\n/* {$css_file_path} */\r\n\r\n";
        /**
         * For basic CSS file paths use this structure:
         * 'CUSTOM_CSS_FILE_SLUG'
         */
        locate_template($css_file_path, true, false);
    }
    $wm_css_content[] = $css_file_path;
}
$output = trim(apply_filters('wmhook_generate_css_output_start', '@charset "UTF-8";' . "\r\n\r\n/**\r\n * CONTENT:\r\n *\r\n * " . implode("\r\n * ", $wm_css_content) . "\r\n */", $wm_css_content)) . "\r\n\r\n\r\n" . ob_get_clean();
//Replace paths (do not use relative paths in stylesheets!)
$replacements = (array) apply_filters('wmhook_generate_css_replacements', array());
if (is_array($replacements) && !empty($replacements)) {
    $output = strtr($output, $replacements);
}
/**
 * Custom styles from skin editor
 */
// locate_template( 'assets/css/_custom-styles.php', true ); //Must be in separate file for WordPress customizer
$output .= "\r\n\r\n\r\n/**\r\n * Skin styles\r\n */\r\n\r\n" . wm_custom_styles() . "\r\n\r\n" . '/* End of file */';
/**
 * Output
 */
echo apply_filters('wmhook_esc_css', $output);
コード例 #6
0
ファイル: setup.php プロジェクト: j5harald/My-First-Site
 function wm_enqueue_assets()
 {
     //Helper variables
     $enqueue_styles = $enqueue_scripts = array();
     $custom_styles = wm_custom_styles();
     $inline_styles_handle = wp_style_is('wm-colors', 'registered') ? 'wm-colors' : 'wm-stylesheet';
     $inline_styles_handle = apply_filters('wmhook_wm_enqueue_assets_inline_styles_handle', $inline_styles_handle);
     /**
      * Styles
      */
     //Google Fonts
     if (wm_google_fonts_url()) {
         $enqueue_styles[] = 'wm-google-fonts';
     }
     //Main
     $enqueue_styles[] = 'wm-stylesheet';
     //Colors
     if ('wm-colors' === $inline_styles_handle) {
         $enqueue_styles[] = 'wm-colors';
     }
     $enqueue_styles = apply_filters('wmhook_wm_enqueue_assets_enqueue_styles', $enqueue_styles);
     foreach ($enqueue_styles as $handle) {
         wp_enqueue_style($handle);
     }
     /**
      * Styles - inline
      */
     //Customizer setup custom styles
     if ($custom_styles) {
         wp_add_inline_style($inline_styles_handle, "\r\n" . apply_filters('wmhook_esc_css', $custom_styles) . "\r\n");
     }
     //Custom styles set in post/page 'custom-css' custom field
     if (is_singular() && ($output = get_post_meta(get_the_ID(), 'custom_css', true))) {
         $output = apply_filters('wmhook_wm_enqueue_assets_singular_inline_styles', "\r\n\r\n/* Custom singular styles */\r\n" . $output . "\r\n");
         wp_add_inline_style($inline_styles_handle, apply_filters('wmhook_esc_css', $output) . "\r\n");
     }
     /**
      * Scripts
      */
     //Masonry footer only if there are more widgets in footer than columns settings
     $footer_widgets = wp_get_sidebars_widgets();
     if (is_array($footer_widgets) && isset($footer_widgets['footer']) && count($footer_widgets['footer']) > absint(apply_filters('wmhook_widgets_columns', 3, 'footer'))) {
         $enqueue_scripts[] = 'jquery-masonry';
     }
     //Global theme scripts
     $enqueue_scripts[] = 'wm-scripts-global';
     //Skip link focus fix
     $enqueue_scripts[] = 'wm-skip-link-focus-fix';
     $enqueue_scripts = apply_filters('wmhook_wm_enqueue_assets_enqueue_scripts', $enqueue_scripts);
     foreach ($enqueue_scripts as $handle) {
         wp_enqueue_script($handle);
     }
 }