Example #1
0
function popmake_render_popup_theme_styles()
{
    if (current_action() == 'wp_head' && popmake_get_option('disable_popup_theme_styles', false) || current_action() == 'admin_head' && !popmake_is_admin_popup_page()) {
        return;
    }
    $styles = get_transient('popmake_theme_styles');
    if (!$styles) {
        $styles = '';
        $google_fonts = array();
        foreach (popmake_get_all_popup_themes() as $theme) {
            $theme_styles = popmake_render_theme_styles($theme->ID);
            $google_fonts = array_merge($google_fonts, popmake_get_popup_theme_google_fonts($theme->ID));
            if ($theme_styles != '') {
                $styles .= "/* Popup Theme " . $theme->ID . ": " . $theme->post_title . " */\r\n";
                $styles .= $theme_styles;
            }
        }
        if (!empty($google_fonts)) {
            $link = "//fonts.googleapis.com/css?family=";
            foreach ($google_fonts as $font_family => $variants) {
                if ($link != "//fonts.googleapis.com/css?family=") {
                    $link .= "|";
                }
                $link .= $font_family;
                if (!empty($variants)) {
                    $link .= ":";
                    $link .= implode(',', $variants);
                }
            }
            $styles = "/* Popup Google Fonts */\r\n@import url('{$link}');\r\n\r\n" . $styles;
        }
        set_transient('popmake_theme_styles', $styles, 7 * DAY_IN_SECONDS);
    }
    echo '<style id="popup-maker-themes"  type="text/css">' . $styles . '</style>';
}
Example #2
0
function popmake_render_popup_theme_styles()
{
    if (current_action() == 'wp_head' && popmake_get_option('disable_popup_theme_styles', false) || current_action() == 'admin_head' && !popmake_is_admin_popup_page()) {
        return;
    }
    $styles = get_transient('popmake_theme_styles');
    if (!$styles) {
        $styles = '';
        foreach (popmake_get_all_popup_themes() as $theme) {
            $theme_styles = popmake_render_theme_styles($theme->ID);
            if ($theme_styles != '') {
                $styles .= "/* Popup Theme " . $theme->ID . ": " . $theme->post_title . " */\r\n";
                $styles .= $theme_styles;
            }
        }
        set_transient('popmake_theme_styles', $styles, 7 * DAY_IN_SECONDS);
    }
    //	echo '<style id="popup-maker-themes"  type="text/css">' . $styles . '</style>';
}