<?php

function lovely_option_styles(){
    $fonts = get_theme_mod( 'ot_google_fonts', array() );

    $bodyFont=lovely_option('body_font');
    $headingFont = lovely_option('heading_font');
    ?>
    <style type="text/css" id="lovely-css">
        <?php 
            if( !empty($bodyFont['font-family']) ){
                echo 'body{'.
                        'font-family:'.esc_attr($fonts[$bodyFont['font-family']]['family']).', "Helvetica Neue", Helvetica, sans-serif;'.
                        (!empty($bodyFont['font-size']) ? ('font-size:'.esc_attr($bodyFont['font-size']).';') : '').
                '}';
            }
            if( !empty($headingFont['font-family']) ){
                echo 'h1,h2,h3,h4,h5,h6,.entry-title,blockquote{'.
                        'font-family:'.esc_attr($fonts[$headingFont['font-family']]['family']).', "Helvetica Neue", Helvetica, sans-serif;'.
                '}';
            }
            if( !empty($headingFont['font-size']) ){
                echo '.entry-title{'.
                       'font-size:'.esc_attr($headingFont['font-size']).';'.
                '}';
            }            
        ?>
       <?php echo lovely_option('custom_css');?>
    </style><?php
}
add_action('wp_head', 'lovely_option_styles', 100);