Пример #1
0
/**
 * Loads the JavaScript and CSS files required for using the color picker on the theme settings
 * page, which allows users to change the link color
 *
 * @param string $hook_suffix The current page being viewed.
 * @return void
 * @since Cakifo 1.4
 */
function cakifo_theme_settings_enqueue_scripts($hook_suffix)
{
    if ($hook_suffix != hybrid_get_settings_page_name()) {
        return;
    }
    wp_enqueue_style('cakifo-theme-settings-color-picker', get_template_directory_uri() . '/functions/admin/color-picker.css', false, '1.4');
    wp_enqueue_script('cakifo-theme-settings-color-picker', get_template_directory_uri() . '/functions/admin/color-picker.js', array('farbtastic'), '1.4');
    wp_enqueue_style('farbtastic');
}
Пример #2
0
/**
 * Sets up the admin functionality for the News theme.
 *
 * @since 0.2.0
 */
function news_admin_setup()
{
    $prefix = hybrid_get_prefix();
    $settings_page = hybrid_get_settings_page_name();
    /* Load theme settings meta boxes. */
    add_action("load-{$settings_page}", 'news_create_settings_meta_boxes');
    /* Validate theme settings. */
    add_filter("sanitize_option_{$prefix}_theme_settings", 'news_validate_theme_settings');
}
Пример #3
0
/**
 * Adds the core about theme meta box to the theme settings page.
 *
 * @since 1.2.0
 * @return void
 */
function hybrid_meta_box_theme_add_about()
{
    /* Get theme information. */
    $prefix = hybrid_get_prefix();
    $theme = wp_get_theme(get_template(), get_theme_root(get_template_directory()));
    /* Adds the About box for the parent theme. */
    add_meta_box('hybrid-core-about-theme', sprintf(__('About %s', 'hybrid-core'), $theme->get('Name')), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high');
    /* If the user is using a child theme, add an About box for it. */
    if (is_child_theme()) {
        $child = wp_get_theme(get_stylesheet(), get_theme_root(get_stylesheet_directory()));
        add_meta_box('hybrid-core-about-child', sprintf(__('About %s', 'hybrid-core'), $child->get('Name')), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high');
    }
}
/**
 * Adds the core about theme meta box to the theme settings page.
 *
 * @since 1.2.0
 * @return void
 */
function hybrid_meta_box_theme_add_about()
{
    /* Get theme information. */
    $prefix = hybrid_get_prefix();
    $theme_data = hybrid_get_theme_data();
    /* Adds the About box for the parent theme. */
    add_meta_box('hybrid-core-about-theme', sprintf(__('About %1$s', 'hybrid-core'), $theme_data['Title']), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high');
    /* If the user is using a child theme, add an About box for it. */
    if (is_child_theme()) {
        $child_data = hybrid_get_theme_data('stylesheet');
        add_meta_box('hybrid-core-about-child', sprintf(__('About %1$s', 'hybrid-core'), $child_data['Title']), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high');
    }
}
Пример #5
0
/**
 * Loads the JavaScript required for toggling the meta boxes on the theme settings page.
 *
 * @since 0.7.0
 * @return void
 */
function hybrid_settings_page_load_scripts()
{
    ?>
	<script type="text/javascript">
		//<![CDATA[
		jQuery(document).ready( function($) {
			$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
			postboxes.add_postbox_toggles( '<?php 
    echo hybrid_get_settings_page_name();
    ?>
' );
		});
		//]]>
	</script><?php 
}
/**
 * Adds the core theme footer meta box to the theme settings page in the admin.
 *
 * @since 1.2.0
 * @return void
 */
function hybrid_meta_box_theme_add_footer()
{
    add_meta_box('hybrid-core-footer', __('Footer settings', 'hybrid-core'), 'hybrid_meta_box_theme_display_footer', hybrid_get_settings_page_name(), 'normal', 'high');
}