I have figured out how to set default values for everything except the font family & font-weight. Is it possible to set a default value for the font family and font-weight? If so, what am I missing? Great plugin btw!
Screen-shot showing no font family select: http://i.imgur.com/BH8ZJHJ.png
Code Used (Modified from:https://wordpress.org/support/topic/action-hooks-and-filters?replies=9 ):
<?php
/**
* How to add a new tab
*
* This function shows you how to add a new
* tab/section to the typography panel in the
* customizer.
*
* @param array $tabs - Existing Tabs.
* @return array $tabs - Tabs with new tabs added.
*
* @since 1.0
* @version 1.0
*
*/
function pro_add_tab_to_panel( $tabs ) {
// Do this for each tab you want to create.
// Make sure the array index matches the
// 'name' array property.
$tabs['pro-header'] = array(
'name' => 'pro-header',
'panel' => 'tt_font_typography_panel',
'title' => __('Header Fonts Panel', 'progression'),
'description' => __('Modify header fonts', 'progression'),
'sections' => array(),
);
// Return the tabs.
return $tabs;
}
add_filter( 'tt_font_get_settings_page_tabs', 'pro_add_tab_to_panel' );
/**
* How to add a font control to your tab
*
* @see parse_font_control_array() - in class EGF_Register_Options
* in includes/class-egf-register-options.php to see the full
* properties you can add for each font control.
*
*
* @param array $controls - Existing Controls.
* @return array $controls - Controls with controls added/removed.
*
* @since 1.0
* @version 1.0
*
*/
function pro_add_control_to_tab( $controls ) {
/**
* 1. Removing default styles because we add-in our own
*/
unset( $controls['tt_default_body'] );
unset( $controls['tt_default_heading_1'] );
unset( $controls['tt_default_heading_2'] );
unset( $controls['tt_default_heading_3'] );
unset( $controls['tt_default_heading_4'] );
unset( $controls['tt_default_heading_5'] );
unset( $controls['tt_default_heading_6'] );
/**
* 2. Now custom examples that are theme specific
*/
/* Header Fonts Panel */
$controls['pro_nav_fonts'] = array(
'name' => 'pro_nav_fonts',
'type' => 'font',
'title' => __('Navigation Font', 'progression'),
'tab' => 'pro-header',
'properties' => array( 'selector' => 'header#masthead-pro nav' ),
'default' => array(
'subset' => 'latin',
'font_name' => 'Oswald',
'font_weight_style' => '600',
'font_color' => '#9a9a9c',
'line_height' => '1',
'font_size' => array( 'amount' => '15', 'unit' => 'px' ),
'letter_spacing' => array( 'amount' => '0.5', 'unit' => 'px' )
),
);
// Return the controls.
return $controls;
}
add_filter( 'tt_font_get_option_parameters', 'pro_add_control_to_tab' );