Example #1
0
function max_get_google_font_html()
{
    // get the fonts
    $body_font = get_option_max('font_body');
    $widget_font = get_option_max('font_widget');
    $nav_font = get_option_max('font_navigation');
    $pulldown_font = get_option_max('font_navigation_pulldown');
    $fsg_title_font = get_option_max('font_fullsize_title');
    $fsg_excerpt_font = get_option_max('font_fullsize_excerpt');
    $welcome_teaser_font = get_option_max('font_welcome_teaser');
    $blog_font = get_option_max('font_blog_header');
    $font_array = array($body_font['font_family'], $widget_font['font_family'], $nav_font['font_family'], $pulldown_font['font_family'], $blog_font['font_family']);
    $_google_fonts = array();
    for ($h = 1; $h <= 6; $h++) {
        $_google_fonts['h' . $h] = get_option_max('font_h' . $h);
    }
    foreach ($_google_fonts as $get_google_font) {
        // get the headline font
        $_temp_font_array[] = $get_google_font['font_family'];
    }
    // combine both arrays
    $get_fonts = array_merge($font_array, $_temp_font_array);
    // Main Color styles
    ?>
<style type="text/css">

	body.black-theme,
	body.white-theme  {
		font: <?php 
    echo $body_font['font_size'];
    ?>
px/<?php 
    echo $body_font['line_height'];
    ?>
px <?php 
    echo max_get_font_string($body_font['font_family']);
    ?>
; font-weight: <?php 
    echo $body_font['font_weight'];
    ?>
;
		color: <?php 
    echo $body_font['font_color'];
    ?>
	}

	#showtitle, #slidecaption, #responsiveTitle  {
		font-family: <?php 
    echo max_get_font_string($_google_fonts['h1']['font_family']) . ', "Helvetica Neue", Helvetica, Arial, sans-serif';
    ?>
;
		font-weight: 300;
	}

	nav#navigation ul li a {
		color: <?php 
    echo $nav_font['font_color'];
    ?>
; font: <?php 
    echo $nav_font['font_size'];
    ?>
px/<?php 
    echo $nav_font['line_height'];
    ?>
px <?php 
    echo max_get_font_string($nav_font['font_family']);
    ?>
; font-weight: <?php 
    echo $nav_font['font_weight'];
    ?>
	}

	nav#navigation ul ul.sub-menu li a  {
		color: <?php 
    echo $pulldown_font['font_color'];
    ?>
; font: <?php 
    echo $pulldown_font['font_size'];
    ?>
px/<?php 
    echo $pulldown_font['line_height'];
    ?>
px <?php 
    echo max_get_font_string($pulldown_font['font_family']);
    ?>
; font-weight: <?php 
    echo $pulldown_font['font_weight'];
    ?>
	}

	h1, h1 a:link, h1 a:visited { color: <?php 
    echo $_google_fonts['h1']['font_color'];
    ?>
; font: <?php 
    echo $_google_fonts['h1']['font_size'];
    ?>
px/<?php 
    echo $_google_fonts['h1']['line_height'];
    ?>
px <?php 
    echo max_get_font_string($_google_fonts['h1']['font_family']);
    ?>
; font-weight: <?php 
    echo $_google_fonts['h1']['font_weight'];
    ?>
; }
	h2 { color: <?php 
    echo $_google_fonts['h2']['font_color'];
    ?>
; font: <?php 
    echo $_google_fonts['h2']['font_size'];
    ?>
px/<?php 
    echo $_google_fonts['h2']['line_height'];
    ?>
px <?php 
    echo max_get_font_string($_google_fonts['h2']['font_family']);
    ?>
; font-weight: <?php 
    echo $_google_fonts['h2']['font_weight'];
    ?>
; }
	h3 { color: <?php 
    echo $_google_fonts['h3']['font_color'];
    ?>
; font: <?php 
    echo $_google_fonts['h3']['font_size'];
    ?>
px/<?php 
    echo $_google_fonts['h3']['line_height'];
    ?>
px <?php 
    echo max_get_font_string($_google_fonts['h3']['font_family']);
    ?>
; font-weight: <?php 
    echo $_google_fonts['h3']['font_weight'];
    ?>
; }
	h4 { color: <?php 
    echo $_google_fonts['h4']['font_color'];
    ?>
; font: <?php 
    echo $_google_fonts['h4']['font_size'];
    ?>
px/<?php 
    echo $_google_fonts['h4']['line_height'];
    ?>
px <?php 
    echo max_get_font_string($_google_fonts['h4']['font_family']);
    ?>
; font-weight: <?php 
    echo $_google_fonts['h4']['font_weight'];
    ?>
; }
	h5 { color: <?php 
    echo $_google_fonts['h5']['font_color'];
    ?>
; font: <?php 
    echo $_google_fonts['h5']['font_size'];
    ?>
px/<?php 
    echo $_google_fonts['h5']['line_height'];
    ?>
px <?php 
    echo max_get_font_string($_google_fonts['h5']['font_family']);
    ?>
; font-weight: <?php 
    echo $_google_fonts['h5']['font_weight'];
    ?>
; }
	h6 { color: <?php 
    echo $_google_fonts['h6']['font_color'];
    ?>
; font: <?php 
    echo $_google_fonts['h6']['font_size'];
    ?>
px/<?php 
    echo $_google_fonts['h6']['line_height'];
    ?>
px <?php 
    echo max_get_font_string($_google_fonts['h6']['font_family']);
    ?>
; font-weight:  <?php 
    echo $_google_fonts['h6']['font_weight'];
    ?>
; }


	#sidebar h1.widget-title, #sidebar h2.widget-title {
		color: <?php 
    echo $widget_font['font_color'];
    ?>
; font: <?php 
    echo $widget_font['font_size'];
    ?>
px/<?php 
    echo $widget_font['line_height'];
    ?>
px <?php 
    echo max_get_font_string($widget_font['font_family']);
    ?>
 !important; font-weight: <?php 
    echo $widget_font['font_weight'];
    ?>
;
	}

	#welcomeTeaser, #sidebar .max_widget_teaser {
  	font-family: <?php 
    echo $welcome_teaser_font['font_family'];
    ?>
;
  	font-size: <?php 
    echo $welcome_teaser_font['font_size'];
    ?>
px;
  	color: <?php 
    echo $welcome_teaser_font['font_color'];
    ?>
;
  	line-height: <?php 
    echo $welcome_teaser_font['line_height'];
    ?>
px;
  	font-weight: <?php 
    echo $welcome_teaser_font['font_weight'];
    ?>
;
	}

  <?php 
    if (!empty($blog_font)) {
        ?>
  .blog h2.entry-title,
  .tag h2.entry-title {
		font: <?php 
        echo $blog_font['font_size'];
        ?>
px/<?php 
        echo $blog_font['line_height'];
        ?>
px <?php 
        echo max_get_font_string($blog_font['font_family']);
        ?>
; font-weight: <?php 
        echo $blog_font['font_weight'];
        ?>
;
		color: <?php 
        echo $blog_font['font_color'];
        ?>
  }
  <?php 
    }
    ?>

	<?php 
    if (get_option_max('homepage_teaser_font_size_bold') != "") {
        ?>
	#welcomeTeaser .inner strong, #sidebar .max_widget_teaser strong { font-size: <?php 
        echo get_option_max('homepage_teaser_font_size_bold');
        ?>
%; }
	<?php 
    }
    ?>

	<?php 
    if (get_option_max('font_fullsize_title') != "") {
        ?>
	#showtitle .imagetitle { color: <?php 
        echo $fsg_title_font['font_color'];
        ?>
!important; font: <?php 
        echo $fsg_title_font['font_size'];
        ?>
px/<?php 
        echo $fsg_title_font['line_height'];
        ?>
px <?php 
        echo max_get_font_string($fsg_title_font['font_family']);
        ?>
!important; font-weight: <?php 
        echo $fsg_title_font['font_weight'];
        ?>
 !important; }
	<?php 
    }
    ?>

	<?php 
    if (get_option_max('font_fullsize_excerpt') != "") {
        ?>
	#showtitle .imagecaption { color: <?php 
        echo $fsg_excerpt_font['font_color'];
        ?>
; font: <?php 
        echo $fsg_excerpt_font['font_size'];
        ?>
px/<?php 
        echo $fsg_excerpt_font['line_height'];
        ?>
px <?php 
        echo max_get_font_string($fsg_excerpt_font['font_family']);
        ?>
!important; font-weight: <?php 
        echo $fsg_excerpt_font['font_weight'];
        ?>
 !important; }
	<?php 
    }
    ?>

</style>
	<?php 
}
function max_get_twitter_js()
{
    // get the body font
    $body_font = get_option_max('font_body');
    ?>

<script type="text/javascript">
	jQuery(document).ready(function($){

		// Customize twitter feed
		var hideTwitterAttempts = 0,
				twitterLoaded = false,
				ibody;
		function hideTwitterBoxElements() {
				var twitterAttempts = setTimeout( function() {
						if ( $('[id*=twitter]').length ) {

							$('[id*=twitter]').each( function(){

									$(this).width( '100%' ); //override the width

									ibody = $(this).contents().find( 'body' );

									if ( ibody.find( '.timeline .stream .h-feed li.tweet' ).length ) {

										// change the body color
										ibody.find( 'html, body, h1, h2, h3, blockquote, p, ol, ul, li, img, iframe, button' ).css({ 'font-family': '<?php 
    echo max_get_font_string($body_font['font_family']);
    ?>
', 'color': '<?php 
    echo $body_font['font_color'];
    ?>
' });

										// change the link color
										ibody.find('.thm-dark .p-author .profile .p-name').css({ 'color' : '<?php 
    echo get_option_max('color_main_link');
    ?>
' });

										// add a border bottom
										ibody.find('li.tweet').css({ 'border-bottom': '1px dotted' });

										twitterLoaded == true;

									} else {

										$(this).hide();

									}

							});

						}
						hideTwitterAttempts++;
						if ( hideTwitterAttempts < 3 && twitterLoaded === false ) {
								hideTwitterBoxElements();
						}
				}, 1500);
		}

		// somewhere in your code after html page load
		hideTwitterBoxElements();
	})

	</script>

<?php 
}