get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
// Add Sections
$wp_customize->add_section('fonts' , array(
'title' => __('Fonts','angularity'),
));
$wp_customize->add_section('angles' , array(
'title' => __('Angularity','angularity'),
));
$wp_customize->add_section('image_options' , array(
'title' => __('Image Options','angularity'),
));
$wp_customize->add_section('site_title' , array(
'title' => __('Site Title','angularity'),
));
//Colors
$colors = array();
$colors[] = array(
'slug'=>'site_title_color',
'default' => '',
'label' => __('Site Title Color', 'angularity'),
'transport' => 'postMessage'
);
$colors[] = array(
'slug'=>'text_color',
'default' => '',
'label' => __('Text Color', 'angularity'),
'transport' => 'postMessage'
);
$colors[] = array(
'slug'=>'accent_color',
'default' => '',
'label' => __('Accent Color', 'angularity'),
'transport' => 'postMessage'
);
$colors[] = array(
'slug'=>'entry_title_color',
'default' => '',
'label' => __('Entry Title Color', 'angularity'),
'transport' => 'postMessage'
);
$colors[] = array(
'slug'=>'links_color',
'default' => '',
'label' => __('Links Color', 'angularity'),
'transport' => 'postMessage'
);
foreach( $colors as $color ) {
// SETTINGS
$wp_customize->add_setting(
$color['slug'], array(
'default' => $color['default'],
'type' => 'option',
'capability' =>
'edit_theme_options',
'transport' => 'postMessage'
)
);
// CONTROLS
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$color['slug'],
array('label' => $color['label'],
'section' => 'colors',
'settings' => $color['slug'])
)
);
}
// Add Logo
$wp_customize->add_setting( 'site_title_image' );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'site_title_image', array(
'label' => __( 'Site Title Image', 'angularity' ),
'section' => 'title_tagline',
'priority' => 2,
'settings' => 'site_title_image',
) ) );
$wp_customize->add_setting('no_angles', array(
'default' => '',
));
$wp_customize->add_control('no_angles', array(
'label' => __('Angles', 'angularity'),
'section' => 'angles',
'settings' => 'no_angles',
'type' => 'radio',
'priority' => 7,
'choices' => array(
'' => 'Clear',
'' => 'Show Angles',
'square-angles' => 'Square Angles'
),
));
$wp_customize->add_setting('site_title_weight', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('site_title_weight', array(
'label' => __('Site Title Weight', 'angularity'),
'section' => 'title_tagline',
'settings' => 'site_title_weight',
'type' => 'radio',
'priority' => 7,
'choices' => array(
'' => 'Clear',
'100' => '100',
'200' => '200',
'300' => '300',
'400' => '400',
'600' => '600',
'500' => '500',
'700' => '700',
'800' => '800',
'900' => '900'
),
));
$wp_customize->add_setting('site_title_size', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('site_title_size', array(
'label' => __('Site Title Size', 'angularity'),
'section' => 'title_tagline',
'settings' => 'site_title_size',
'type' => 'radio',
'priority' => 6,
'choices' => array(
'' => 'Clear',
'2.1rem' => '21px',
'2.4rem' => '24px',
'2.8rem' => '28px',
'3.2rem' => '32px',
'3.7rem' => '37px',
'4.2rem' => '42px',
'4.9rem' => '49px',
'5.6rem' => '56px',
'6.4rem' => '64px'
),
));
$wp_customize->add_setting('page_title_size', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('page_title_size', array(
'label' => __('Page Title Size', 'angularity'),
'section' => 'fonts',
'settings' => 'page_title_size',
'type' => 'select',
'priority' => 5,
'choices' => array(
'' => 'Clear',
'2.1rem' => '21px',
'2.4rem' => '24px',
'2.8rem' => '28px',
'3.2rem' => '32px',
'3.7rem' => '37px',
'4.2rem' => '42px',
'4.9rem' => '49px',
'5.6rem' => '56px',
'6.4rem' => '64px'
),
));
$wp_customize->add_setting('page_title_weight', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('page_title_weight', array(
'label' => __('Page Title Weight', 'angularity'),
'section' => 'fonts',
'settings' => 'page_title_weight',
'type' => 'select',
'priority' => 4,
'choices' => array(
'' => 'Clear',
'100' => '100',
'200' => '200',
'300' => '300',
'400' => '400',
'500' => '500',
'600' => '600',
'700' => '700',
'800' => '800',
'900' => '900'
),
));
$wp_customize->add_setting('body_font_size', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('body_font_size', array(
'label' => __('Body Font Size', 'angularity'),
'section' => 'fonts',
'settings' => 'body_font_size',
'type' => 'select',
'priority' => 3,
'choices' => array(
'' => 'Clear',
'1.4rem' => '14px',
'1.6rem' => '16px',
'1.8rem' => '18px',
'2.1rem' => '21px',
'2.4rem' => '24px'
),
));
$wp_customize->add_setting('image_border', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('image_border', array(
'label' => __('Image Border', 'angularity'),
'section' => 'image_options',
'settings' => 'image_border',
'type' => 'radio',
'priority' => 3,
'choices' => array(
'' => 'Clear',
'0px' => '0px',
'1px' => '1px',
'2px' => '2px',
'3px' => '3px',
'4px' => '4px',
'5px' => '5px'
),
));
$wp_customize->add_setting('rounded_image_corners', array(
'default' => '',
'transport' => 'postMessage',
));
$wp_customize->add_control('rounded_image_corners', array(
'label' => __('Rounded Image Corners', 'angularity'),
'section' => 'image_options',
'settings' => 'rounded_image_corners',
'type' => 'radio',
'priority' => 3,
'choices' => array(
'' => 'Clear',
'0px' => '0px',
'5px' => '5px',
'10px' => '10px',
'20px' => '20px',
'30px' => '30px',
'40px' => '40px',
'50px' => '50px',
'80px' => '80px',
'120px' => '120px'
),
));
// Fonts
$wp_customize->add_setting('content_font', array(
'default' => '',
));
$wp_customize->add_control('content_font', array(
'label' => __('Content Font', 'angularity'),
'section' => 'fonts',
'settings' => 'content_font',
'type' => 'select',
'priority' => 1,
'choices' => array(
'' => 'Clear',
'Lato' => 'Lato',
'Source Sans Pro' => 'Source Sans Pro',
'Open Sans' => 'Open Sans',
'Roboto' => 'Roboto',
'Exo 2' => 'Exo 2',
'Merriweather' => 'Merriweather',
'Merriweather Sans' => 'Merriweather Sans',
'Lora' => 'Lora',
'Raleway' => 'Raleway',
'Josefin Slab' => 'Josefin Slab',
'Quicksand' => 'Quicksand',
'Sintony' => 'Sintony',
'Noto Sans' => 'Noto Sans',
'Droid Sans' => 'Droid Sans',
'Droid Serif' => 'Droid Serif',
'PT Sans' => 'PT Sans',
'Roboto Slab' => 'Roboto Slab',
'Rokkitt' => 'Rokkitt',
'Cabin' => 'Cabin',
'Arvo' => 'Arvo',
'Oldenburg' => 'Oldenburg',
'Cutive Mono' => 'Cutive Mono',
'Sanchez' => 'Sanchez',
'Alegreya' => 'Alegreya',
'Alegreya Sans' => 'Alegreya Sans',
'Lustria' => 'Lustria',
'Arbutus Slab' => 'Arbutus Slab',
'Aleo' => 'Aleo',
'Linux Biolinum' => 'Linux Biolinum',
'Poly' => 'Poly'
),
));
$wp_customize->add_setting('page_title_font', array(
'default' => '',
));
$wp_customize->add_control('page_title_font', array(
'label' => __('Page Title Font', 'angularity'),
'section' => 'fonts',
'settings' => 'page_title_font',
'type' => 'select',
'priority' => 2,
'choices' => array(
'' => 'Clear',
'Lato' => 'Lato',
'Source Sans Pro' => 'Source Sans Pro',
'Open Sans' => 'Open Sans',
'Roboto' => 'Roboto',
'Exo 2' => 'Exo 2',
'Merriweather' => 'Merriweather',
'Merriweather Sans' => 'Merriweather Sans',
'Lora' => 'Lora',
'Raleway' => 'Raleway',
'Josefin Slab' => 'Josefin Slab',
'Quicksand' => 'Quicksand',
'Sintony' => 'Sintony',
'Noto Sans' => 'Noto Sans',
'Droid Sans' => 'Droid Sans',
'Droid Serif' => 'Droid Serif',
'PT Sans' => 'PT Sans',
'Roboto Slab' => 'Roboto Slab',
'Rokkitt' => 'Rokkitt',
'Cabin' => 'Cabin',
'Arvo' => 'Arvo',
'Oldenburg' => 'Oldenburg',
'Cutive Mono' => 'Cutive Mono',
'Sanchez' => 'Sanchez',
'Alegreya' => 'Alegreya',
'Alegreya Sans' => 'Alegreya Sans',
'Lustria' => 'Lustria',
'Arbutus Slab' => 'Arbutus Slab',
'Aleo' => 'Aleo',
'Linux Biolinum' => 'Linux Biolinum',
'Poly' => 'Poly',
'Happy Monkey' => 'Happy Monkey',
'Prosto One' => 'Prosto One',
'McLaren' => 'McLaren',
'Cherry Cream Soda' => 'Cherry Cream Soda',
'Pompiere' => 'Pompiere',
'Stint Ultra Expanded' => 'Stint Ultra Expanded',
'Overlock' => 'Overlock',
'Comfortaa' => 'Comfortaa',
'Architects Daughter' => 'Architects Daughter',
'Covered By Your Grace' => 'Covered By Your Grace',
'Dancing Script' => 'Dancing Script',
'IM Fell Great Primer' => 'IM Fell Great Primer',
'Oxygen' => 'Oxygen'
),
));
}
add_action( 'customize_register', 'angularity_customize_register' );
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function angularity_customize_preview_js() {
wp_enqueue_script( 'angularity_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
}
add_action( 'customize_preview_init', 'angularity_customize_preview_js' );
function customizer_header_code() {
// Colors
$text_color = get_option('text_color');
$entry_title_color = get_option('entry_title_color');
$site_title_color = get_option('site_title_color');
$accent_color = get_option('accent_color');
$entry_title_color = get_option('entry_title_color');
$links_color = get_option('links_color');
// Header Options
$site_title_image = get_theme_mod('site_title_image');
//Fonts
$page_title_size = get_theme_mod('page_title_size');
$site_title_size = get_theme_mod('site_title_size');
$site_title_weight = get_theme_mod('site_title_weight');
$page_title_weight = get_theme_mod('page_title_weight');
$body_font_size = get_theme_mod('body_font_size');
$content_font = get_theme_mod('content_font');
$page_title_font = get_theme_mod('page_title_font');
// Image Options
$image_border = get_theme_mod('image_border');
$rounded_image_corners = get_theme_mod('rounded_image_corners');
//Angularity
$no_angles = get_theme_mod('no_angles');
// load content fonts
if (empty($content_font)):
echo "";
$content_font = 'Source Sans Pro';
elseif ($content_font == 'Raleway'):
echo "";
elseif ($content_font == 'Roboto Slab'):
echo "";
elseif ($content_font == 'Merriweather'):
echo "";
elseif ($content_font == 'Merriweather Sans'):
echo "";
elseif ($content_font == 'Aleo'):
echo '';
elseif ($content_font == 'Linux Biolinum'):
echo '';
elseif ($content_font == 'Alegreya Sans'):
echo "";
elseif ($content_font == 'Alegreya'):
echo "";
elseif ($content_font == 'Arbutus Slab'):
echo "";
elseif ($content_font == 'Poly'):
echo "";
elseif ($content_font == 'Sanchez'):
echo "";
elseif ($content_font == 'Lustria'):
echo "";
elseif ($content_font == 'Josefin Slab'):
echo "";
elseif ($content_font == 'Cutive Mono'):
echo "";
elseif ($content_font == 'Arvo'):
echo "";
elseif ($content_font == 'Sintony'):
echo "";
elseif ($content_font == 'Noto Sans'):
echo "";
elseif ($content_font == 'PT Sans'):
echo "";
elseif ($content_font == 'Quicksand'):
echo "";
elseif ($content_font == 'Cabin'):
echo "";
elseif ($content_font == 'Droid Sans'):
echo "";
elseif ($content_font == 'Droid Serif'):
echo "";
elseif ($content_font == 'Lato'):
echo "";
elseif ($content_font == 'Lora'):
echo "";
elseif ($content_font == 'Open Sans'):
echo "";
elseif ($content_font == 'Source Sans Pro'):
echo "";
elseif ($content_font == 'Roboto'):
echo "";
elseif ($content_font == 'Exo 2'):
echo "";
elseif ($content_font == 'Rokkitt'):
echo "";
elseif ($content_font == ''):
echo "";
endif ;
echo "
";
if ($page_title_font == 'Raleway'):
echo "";
elseif ($page_title_font == 'Roboto Slab'):
echo "";
elseif ($page_title_font == 'Merriweather'):
echo "";
elseif ($page_title_font == 'Merriweather Sans'):
echo "";
elseif ($page_title_font == 'Aleo'):
echo '';
elseif ($page_title_font == 'Linux Biolinum'):
echo '';
elseif ($page_title_font == 'Alegreya'):
echo "";
elseif ($page_title_font == 'Arbutus Slab'):
echo "";
elseif ($page_title_font == 'Poly'):
echo "";
elseif ($page_title_font == 'Sanchez'):
echo "";
elseif ($page_title_font == 'Lustria'):
echo "";
elseif ($page_title_font == 'Josefin Slab'):
echo "";
elseif ($page_title_font == 'Cutive Mono'):
echo "";
elseif ($page_title_font == 'Arvo'):
echo "";
elseif ($page_title_font == 'Sintony'):
echo "";
elseif ($page_title_font == 'Noto Sans'):
echo "";
elseif ($page_title_font == 'PT Sans'):
echo "";
elseif ($page_title_font == 'Quicksand'):
echo "";
elseif ($page_title_font == 'Cabin'):
echo "";
elseif ($page_title_font == 'Droid Sans'):
echo "";
elseif ($page_title_font == 'Droid Serif'):
echo "";
elseif ($page_title_font == 'Lato'):
echo "";
elseif ($page_title_font == 'Lora'):
echo "";
elseif ($page_title_font == 'Open Sans'):
echo "";
elseif ($page_title_font == 'Source Sans Pro'):
echo "";
elseif ($page_title_font == 'Roboto'):
echo "";
elseif ($page_title_font == 'Montserrat'):
echo "";
elseif ($page_title_font == 'Rokkitt'):
echo "";
elseif ($page_title_font == 'Happy Monkey'):
echo "";
elseif ($page_title_font == 'Prosto One'):
echo "";
elseif ($page_title_font == 'McLaren'):
echo "";
elseif ($page_title_font == 'Cherry Cream Soda'):
echo "";
elseif ($page_title_font == 'Pompiere'):
echo "";
elseif ($page_title_font == 'Stint Ultra Expanded'):
echo "";
elseif ($page_title_font == 'Overlock'):
echo "";
elseif ($page_title_font == 'Comfortaa'):
echo "";
elseif ($page_title_font == 'Architects Daughter'):
echo "";
elseif ($page_title_font == 'Covered By Your Grace'):
echo "";
elseif ($page_title_font == 'Dancing Script'):
echo "";
elseif ($page_title_font == 'IM Fell Great Primer'):
echo "";
elseif ($page_title_font == 'Oxygen'):
echo "";
elseif ($page_title_font == ''):
echo "";
endif ;
echo '
';
}
add_action('customizations', 'customizer_header_code');