Пример #1
0
function puzzle_customize_register($wp_customize)
{
    /* Colors */
    $puzzle_colors = new PuzzleColors();
    foreach ($puzzle_colors->colors() as $color) {
        $wp_customize->add_setting($color->id(), array('default' => $color->default_color(), 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh'));
        $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $color->id(), array('label' => $color->label(), 'section' => 'colors', 'settings' => $color->id())));
    }
    /* For nav and footer */
    $background_color_options = array('primary' => 'Primary Color', 'secondary' => 'Secondary Color', 'white' => 'White', 'gray' => 'Gray');
    /* Navigation Bar */
    $wp_customize->add_section('puzzle_nav', array('title' => 'Navigation Bar', 'priority' => 200));
    $wp_customize->add_setting('nav_background_color', array('default' => 'primary', 'sanitize_callback' => 'esc_attr', 'transport' => 'refresh'));
    $wp_customize->add_control('nav_background_color', array('label' => 'Background Color', 'section' => 'puzzle_nav', 'settings' => 'nav_background_color', 'type' => 'select', 'choices' => $background_color_options));
    /* Footer */
    $wp_customize->add_section('puzzle_footer', array('title' => 'Footer', 'priority' => 210));
    $wp_customize->add_setting('footer_background_color', array('default' => 'primary', 'sanitize_callback' => 'esc_attr', 'transport' => 'refresh'));
    $wp_customize->add_control('footer_background_color', array('label' => 'Background Color', 'section' => 'puzzle_footer', 'settings' => 'footer_background_color', 'type' => 'select', 'choices' => $background_color_options));
    $wp_customize->add_setting('footer_content', array('default' => '', 'sanitize_callback' => 'esc_html', 'transport' => 'refresh'));
    $wp_customize->add_control('footer_content', array('label' => 'Content', 'section' => 'puzzle_footer', 'settings' => 'footer_content', 'type' => 'textarea'));
    /* Miscellaneous */
    $wp_customize->add_section('puzzle_miscellaneous', array('title' => 'Miscellaneous', 'priority' => 220));
    $wp_customize->add_setting('disable_smooth_scroll', array('default' => '', 'sanitize_callback' => 'esc_attr', 'transport' => 'refresh'));
    $wp_customize->add_control('disable_smooth_scroll', array('label' => 'Disable smooth scrolling', 'description' => 'Checking this box will turn off the scrolling animation when a user clicks on a link that takes them to another part of the page.', 'section' => 'puzzle_miscellaneous', 'settings' => 'disable_smooth_scroll', 'type' => 'checkbox'));
}
Пример #2
0
<?php

/*
 * Puzzle
 * Default Colors
 */
$primary_color = new PuzzleColor();
$primary_color->set_id('primary_color')->set_label('Primary Color')->set_default_color('#314887');
$secondary_color = new PuzzleColor();
$secondary_color->set_id('secondary_color')->set_label('Secondary Color')->set_default_color('#4b97e3');
$headline_dark = new PuzzleColor();
$headline_dark->set_id('headline_dark')->set_label('Dark Headlines')->set_default_color('#333');
$text_dark = new PuzzleColor();
$text_dark->set_id('text_dark')->set_label('Dark Body Text')->set_default_color('#555');
$headline_light = new PuzzleColor();
$headline_light->set_id('headline_light')->set_label('Light Headlines')->set_default_color('#fff');
$text_light = new PuzzleColor();
$text_light->set_id('text_light')->set_label('Light Body Text')->set_default_color('#fff');
$puzzle_colors = new PuzzleColors();
$puzzle_colors->add_colors(array($primary_color, $secondary_color, $headline_dark, $text_dark, $headline_light, $text_light));
Пример #3
0
<?php

/*
 * Puzzle
 * Custom style colors using admin options
 *
 * The CSS here is converted into /assets/css/custom.css by functions.php if
 * the sheet does not exist yet, and then is updated every time the user
 * updates the theme customizations (see /theme/setup/customize_theme.php).
 */
$puzzle_colors = new PuzzleColors();
$puzzle_default_colors = $puzzle_colors->colors();
$primary_color = get_theme_mod('primary_color', $puzzle_default_colors['primary_color']->default_color());
$secondary_color = get_theme_mod('secondary_color', $puzzle_default_colors['secondary_color']->default_color());
$headline_dark = get_theme_mod('headline_dark', $puzzle_default_colors['headline_dark']->default_color());
$text_dark = get_theme_mod('text_dark', $puzzle_default_colors['text_dark']->default_color());
$headline_light = get_theme_mod('headline_light', $puzzle_default_colors['headline_light']->default_color());
$text_light = get_theme_mod('text_light', $puzzle_default_colors['text_light']->default_color());
$nav_background_color = get_theme_mod('nav_background_color', 'primary');
$footer_background_color = get_theme_mod('footer_background_color', 'primary');
?>
/* Text */

h1, h2, h3, h4, h5, h6, th,
.dark-text-color-scheme h1,
.dark-text-color-scheme h2,
.dark-text-color-scheme h3,
.dark-text-color-scheme h4,
.dark-text-color-scheme h5,
.dark-text-color-scheme h6,
.dark-text-color-scheme th {