コード例 #1
0
ファイル: extras.php プロジェクト: venturepact/blog
/**
 * Retrieve the plugin option.
 *
 * @param string $option - Name of the option to retrieve.
 * @return mixed
 */
function do_esnb_option($option = 'logo')
{
    $do_esnb_options = apply_filters('do_esnb_options', get_option('do_esnb_options'));
    if (isset($do_esnb_options[$option])) {
        return $do_esnb_options[$option];
    } else {
        return do_esnb_option_default($option);
    }
}
コード例 #2
0
/**
 * 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());
    }
}
コード例 #3
0
ファイル: admin.php プロジェクト: venturepact/blog
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>';
}