Template == 'allegiant_pro' ) {
add_filter('body_class', 'ascendant_body_class');
}
// Remove parent font
remove_action('wp_head', 'cpotheme_styling_fonts', 20 );
remove_action('wp_head', 'cpotheme_styling_custom', 20);
remove_filter('cpotheme_background_args', 'cpotheme_background_args');
add_filter('cpotheme_background_args', 'ascendant_child_background_args');
}
function ascendant_body_class( $classes ){
$classes[] = 'allegian_pro_template';
return $classes;
}
//Add public stylesheets
if(!function_exists('ascendant_child_add_styles')){
add_action('wp_enqueue_scripts', 'ascendant_child_add_styles' );
function ascendant_child_add_styles(){
$parent_style = 'cpotheme-main';
wp_enqueue_style( 'ascendant-google-font', 'https://fonts.googleapis.com/css?family=Lato:400,700|Raleway:300,400,500,700,800,900' );
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'ascendant-style',
get_stylesheet_uri(),
array( $parent_style, 'cpotheme-base' ),
wp_get_theme()->get('Version')
);
}
}
if(!function_exists('ascendant_child_add_fontawesome')){
add_action('wp_enqueue_scripts', 'ascendant_child_add_fontawesome',11);
function ascendant_child_add_fontawesome(){
wp_enqueue_style('cpotheme-fontawesome');
}
}
if(!function_exists('ascendant_child_background_args')){
function ascendant_child_background_args($data){
$data = array(
'default-color' => 'fff',
'default-image' => get_stylesheet_directory_uri().'/images/background.jpg',
'default-repeat' => 'no-repeat',
'default-position-x' => 'center',
'default-attachment' => 'fixed',
'wp-head-callback' => 'ascendant_custom_background_cb'
);
return $data;
}
}
add_filter( 'cpotheme_customizer_controls', 'ascendant_add_customizer_fields', 11 );
function ascendant_add_customizer_fields( $data ){
$data['transparent_header'] = array(
'label' => __('Transparent Header', 'ascendant'),
'description' => __('Your header will be transparent.', 'ascendant'),
'section' => 'cpotheme_layout_home',
'type' => 'checkbox',
'sanitize' => 'cpotheme_sanitize_bool',
'default' => '1');
//Typography
if ( isset($data['type_headings']) ) {
$data['type_headings']['default'] = 'Raleway';
}
if ( isset($data['type_nav']) ) {
$data['type_nav']['default'] = 'Raleway';
}
if ( isset($data['type_body']) ) {
$data['type_body']['default'] = 'Lato';
}
if ( isset($data['primary_color']) ) {
$data['primary_color']['default'] = '#70b85d';
}
if ( isset($data['type_headings_color']) ) {
$data['type_headings_color']['default'] = '#18253c';
}
if ( isset($data['type_widgets_color']) ) {
$data['type_widgets_color']['default'] = '#18253c';
}
if ( isset($data['type_nav_color']) ) {
$data['type_nav_color']['default'] = '#18253c';
}
if ( isset($data['type_link_color']) ) {
$data['type_link_color']['default'] = '#70b85d';
}
if ( isset($data['type_body_color']) ) {
$data['type_body_color']['default'] = '#8c9597';
}
if ( isset($data['postpage_dates']) ) {
$data['postpage_dates']['default'] = false;
}
if ( isset($data['postpage_authors']) ) {
$data['postpage_authors']['default'] = false;
}
if ( isset($data['postpage_comments']) ) {
$data['postpage_comments']['default'] = false;
}
if ( isset($data['postpage_categories']) ) {
$data['postpage_categories']['default'] = false;
}
if ( isset($data['postpage_tags']) ) {
$data['postpage_tags']['default'] = false;
}
if ( isset($data['home_tagline_content']) ) {
$data['home_tagline_content']['sanitize'] = 'wp_kses_post';
}
return $data;
}
// Pro Typographi
add_filter('cpotheme_font_headings', 'ascendant_cpotheme_font_headings');
add_filter('cpotheme_font_menu', 'ascendant_cpotheme_font_menu');
add_filter('cpotheme_font_body', 'ascendant_cpotheme_font_body');
function ascendant_cpotheme_font_headings() {
$option_list = get_option('cpotheme_settings', false);
if ( isset($option_list['type_headings']) ) {
return $option_list['type_headings'];
}else{
return "Raleway";
}
}
function ascendant_cpotheme_font_menu() {
$option_list = get_option('cpotheme_settings', false);
if ( isset($option_list['type_nav']) ) {
return $option_list['type_nav'];
}else{
return "Raleway";
}
}
function ascendant_cpotheme_font_body() {
$option_list = get_option('cpotheme_settings', false);
if ( isset($option_list['type_body']) ) {
return $option_list['type_body'];
}else{
return "Lato";
}
}
add_action('wp_head', 'ascendant_cpotheme_styling_custom', 20);
function ascendant_cpotheme_styling_custom(){
$primary_color = cpotheme_get_option('primary_color'); ?>
';
if(cpotheme_get_option('general_texttitle') == 0){
if( cpotheme_get_option('general_logo') ){
$logo_width = cpotheme_get_option('general_logo_width');
$logo_url = esc_url(cpotheme_get_option('general_logo'));
if($logo_width != '') $logo_width = ' style="width:'.esc_attr($logo_width).'px;"';
$output .= '';
}else{
$output .= ''.get_bloginfo('name').'';
}
}
$classes = '';
if(cpotheme_get_option('general_texttitle') == 0) { $classes = ' hidden'; }
if(!is_front_page()){
$output .= ''.get_bloginfo('name').'';
}else{
$output .= '