function popmake_popup_themes_meta_box_field_theme($popup_id) { ?> <tr> <td scope="row"> <label for="popup_theme"><strong><?php _e('Theme', 'popup-maker'); ?> </strong></label> <select name="popup_theme" id="popup_theme" class="input-large"> <?php foreach (popmake_get_all_popup_themes()->posts as $theme) { ?> <option value="<?php echo $theme->ID; ?> " <?php selected($theme->ID, popmake_get_the_popup_theme($popup_id)); ?> > <?php echo $theme->post_title; ?> </option> <?php } ?> </select> <p class="description"><?php _e('Choose a theme for this popup.', 'popup-maker'); ?> </p> </td> </tr><?php }
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>'; }
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>'; }
function popmake_get_popup_themes_data() { $themes = popmake_get_all_popup_themes(); $popmake_themes = array(); foreach ($themes as $theme) { $popmake_themes[$theme->ID] = popmake_get_popup_theme_data_attr($theme->ID); } wp_reset_postdata(); return apply_filters('popmake_get_popup_themes_data', $popmake_themes); }