/** * Enqueue scripts and styles. */ function do_esnb_scripts() { /** * Enqueue CSS files */ // Google Fonts wp_enqueue_style('do-esnb-fonts', do_esnb_google_fonts_url(), array(), null); // Plugin Stylesheet if (1 == do_esnb_option('enable')) { wp_enqueue_style('do-esnb-style', DO_ESNB_URI . 'css/style.css'); } // Plugin Fonts $notification_font = do_esnb_option('notification_font'); $button_font = do_esnb_option('button_font'); // Custom Inline Notification Font CSS if (do_esnb_option_default('notification_font') != $notification_font) { wp_add_inline_style('do-esnb-style', do_esnb_notification_font()); } // Custom Inline Button Font CSS if (do_esnb_option_default('button_font') != $button_font) { wp_add_inline_style('do-esnb-style', do_esnb_button_font()); } }
function do_esnb_field_button_font_cb() { $items = do_esnb_google_fonts(); echo '<select id="button_font" name="do_esnb_options[button_font]">'; foreach ($items as $key => $val) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, do_esnb_option('button_font')); ?> ><?php echo esc_html($val); ?> </option> <?php } echo '</select>'; echo '<div><code>' . __('Select button font.', 'do-esnb') . '</code></div>'; echo '<div><code>' . sprintf(__('Default: %1$s', 'do-esnb'), do_esnb_google_fonts(do_esnb_option_default('button_font'))) . '</code></div>'; }
/** * Notification Bar * * @return void */ function do_esnb_init() { // Enable Validation if (0 == do_esnb_option('enable')) { return; } // Notification Bar Markup ?> <div class="do-esnb-wrapper"> <div class="do-esnb-inside"> <div class="do-esnb-notification"> <?php if ('' != do_esnb_option('notification')) { ?> <?php if ('' == do_esnb_option('notification_link')) { ?> <?php echo esc_html(do_esnb_option('notification')); ?> <?php } else { ?> <a class="do-esnb-notification-link" href="<?php echo esc_url(do_esnb_option('notification_link')); ?> "> <?php echo esc_html(do_esnb_option('notification')); ?> </a> <?php } ?> <?php } ?> <?php if (1 == do_esnb_option('display_button')) { ?> <a class="do-esnb-button" href="<?php echo esc_url(do_esnb_option('button_link')); ?> "> <?php echo esc_html(do_esnb_option('button_label')); ?> </a><!-- .do-esnb-button --> <?php } ?> </div><!-- .do-esnb-notification --> </div><!-- .do-esnb-inside --> </div><!-- .do-esnb-wrapper --> <?php }