/**
 * Returns an array of background scheme choices registered.
 *
 * @since Fastfood 0.37
 *
 * @return array Array of background schemes thumbnails.
 */
function fastfood_get_background_schemes_thumbnails()
{
    $background_schemes = fastfood_get_background_schemes();
    $background_scheme_control_options = array();
    foreach ($background_schemes as $background_scheme => $value) {
        $background_scheme_control_options[$background_scheme] = '<img src="' . $value['thumbnail'] . '" alt="' . esc_attr($value['label']) . '"/>';
    }
    return $background_scheme_control_options;
}
Beispiel #2
0
/**
 * Enqueues front-end custom CSS.
 *
 * @since Fastfood 0.37
 *
 * @see wp_add_inline_style()
 */
function fastfood_dynamic_css()
{
    // gathers the theme mods
    $mods = array('background_color', 'background_repeat', 'background_attachment', 'background_position_x', 'background_position_y', 'background_image', 'background_icons_color');
    $attributes = fastfood_get_background_schemes('0');
    $attributes = $attributes['attributes'];
    foreach ($mods as $attribute_key) {
        $attributes[$attribute_key] = get_theme_mod($attribute_key, $attributes[$attribute_key]);
    }
    $attributes['background_color'] = '#' . str_replace('#', '', $attributes['background_color']);
    // gathers the theme options
    $opts = array('fastfood_colors_link', 'fastfood_colors_link_hover', 'fastfood_colors_link_sel', 'fastfood_body_width', 'fastfood_rsideb_width', 'fastfood_featured_title_size');
    foreach ($opts as $attribute_key) {
        $attributes[$attribute_key] = FastfoodOptions::get_opt($attribute_key);
    }
    $attributes['fastfood_rsideb_width'] = round(absint($attributes['fastfood_rsideb_width']) / absint($attributes['fastfood_body_width']), 5) * 100;
    $attributes['fastfood_content_width'] = 100 - $attributes['fastfood_rsideb_width'];
    $attributes['fastfood_featured_title_size'] = absint($attributes['fastfood_featured_title_size']);
    $dynamic_css = fastfood_get_dynamic_css($attributes);
    wp_add_inline_style('fastfood', $dynamic_css);
}
Beispiel #3
0
 /**
  * Binds JS listener to Customizer controls.
  *
  * Passes background scheme data as backgroundScheme global.
  *
  * @since Fastfood 0.37
  */
 function customize_control_js()
 {
     wp_enqueue_script('fastfood-customize-controls', sprintf('%1$s/js/customize-controls.js', get_template_directory_uri()), array('customize-controls', 'iris', 'underscore', 'wp-util', 'jquery', 'jquery-ui-slider', 'jquery-ui-accordion', 'jquery-ui-sortable'), fastfood_get_info('version'), true);
     apply_filters('fastfood_customize_controls_js_data', $data = array('backgroundScheme' => fastfood_get_background_schemes(), 'controls' => array('background_color' => 'background_color', 'background_repeat' => 'background_repeat', 'background_attachment' => 'background_attachment', 'background_position_x' => 'background_position_x', 'background_position_y' => 'background_position_y', 'background_image' => 'background_image', 'background_icons_color' => 'background_icons_color', 'fastfood_colors_link' => 'fastfood_options[fastfood_colors_link]', 'fastfood_colors_link_hover' => 'fastfood_options[fastfood_colors_link_hover]', 'fastfood_colors_link_sel' => 'fastfood_options[fastfood_colors_link_sel]', 'fastfood_body_width' => 'fastfood_options[fastfood_body_width]', 'fastfood_rsideb_width' => 'fastfood_options[fastfood_rsideb_width]', 'fastfood_featured_title_size' => 'fastfood_options[fastfood_featured_title_size]'), 'headers' => $this->controls_headers, 'labels' => array('remove' => __('Remove', 'fastfood'))));
     wp_localize_script('fastfood-customize-controls', '_fastfoodCustomizeControls', $data);
 }