File: /home/dwauav0tm6jp/hosted/jeffreyjhart_com/wp-content/themes/skylab/inc/style.php
<?php
/**
* Filter Primary Typography Fonts.
*/
function filter_ot_recognized_font_families( $array, $field_id ) {
if ( $field_id == 'primary_typography' || $field_id == 'menu_typography' || $field_id == 'header_typography' ) {
$systemFontSelect = array(
'Arial' => 'Arial',
'Calibri' => 'Calibri',
'Century Gothic' => 'Century Gothic',
'Courier' => 'Courier',
'Courier New' => 'Courier New',
'Georgia' => 'Georgia',
'Modern' => 'Modern',
'Tahoma' => 'Tahoma',
'Times New Roman' => 'Times New Roman',
'Trebuchet MS' => 'Trebuchet MS',
'Verdana' => 'Verdana'
);
$array = $systemFontSelect;
}
return $array;
}
add_filter( 'ot_recognized_font_families', 'filter_ot_recognized_font_families', 10, 2 );
/**
* A safe way to add/enqueue a CSS/JavaScript to the wordpress generated page.
*/
function mega_enqueue_google_fonts() {
$google_font_family = ot_get_option( 'google_font_family' );
if ( ! empty( $google_font_family ) ) {
echo $google_font_family;
}
}
add_action( 'wp_head', 'mega_enqueue_google_fonts' );
function mega_enqueue_menu_google_fonts() {
$menu_google_font_family = ot_get_option( 'menu_google_font_family' );
if ( ! empty( $menu_google_font_family ) ) {
echo $menu_google_font_family;
}
}
add_action( 'wp_head', 'mega_enqueue_menu_google_fonts' );
function mega_enqueue_header_google_fonts() {
$header_google_font_family = ot_get_option( 'header_google_font_family' );
if ( ! empty( $header_google_font_family ) ) {
echo $header_google_font_family;
}
}
add_action( 'wp_head', 'mega_enqueue_header_google_fonts' );
/**
* Add a style block to the theme for the primary typography.
*/
function mega_print_primary_typography() {
$primary_typography = ot_get_option( 'primary_typography', array() );
$google_font_name = ot_get_option( 'google_font_name' );
if ( ! empty( $google_font_name ) ) {
$primary_font = $google_font_name;
} else if ( ! empty( $primary_typography['font-family'] ) ) {
$primary_font = $primary_typography['font-family'];
}
// Don't do anything if the font-family is empty.
if ( ! empty( $primary_typography['font-family'] ) || ! empty( $google_font_name ) ) :
?>
<style>
/* Primary Typography */
body, input, textarea, select {
font-family: "<?php echo $primary_font; ?>", 'Helvetica Neue', Helvetica, sans-serif;
}
/* AddThis Typography */
#at16recap, #at_msg, #at16p label, #at16nms, #at16sas, #at_share .at_item, #at16p, #at15s, #at16p form input, #at16p textarea {
font-family: "<?php echo $primary_font; ?>", 'Helvetica Neue', Helvetica, sans-serif !important;
}
</style>
<?php
endif;
}
add_action( 'wp_head', 'mega_print_primary_typography' );
/**
* Add a style block to the theme for the menu typography.
*/
function mega_print_menu_typography() {
$menu_typography = ot_get_option( 'menu_typography' );
$menu_google_font_name = ot_get_option( 'menu_google_font_name' );
if ( ! empty( $menu_google_font_name ) ) {
$menu_font = $menu_google_font_name;
} else if ( ! empty( $menu_typography['font-family'] ) ) {
$menu_font = $menu_typography['font-family'];
}
// Don't do anything if the font-family is empty.
if ( ! empty( $menu_typography['font-family'] ) || ! empty( $menu_google_font_name ) ) :
?>
<style>
/* Menu Typography */
#access ul,
#access-mobile,
#tagline h2 {
font-family: "<?php echo $menu_font; ?>", 'Helvetica Neue', Helvetica, sans-serif;
}
</style>
<?php
endif;
}
add_action( 'wp_head', 'mega_print_menu_typography' );
/**
* Add a style block to the theme for the header typography.
*/
function mega_print_header_typography() {
$header_typography = ot_get_option( 'header_typography' );
$header_google_font_name = ot_get_option( 'header_google_font_name' );
if ( ! empty( $header_google_font_name ) ) {
$header_font = $header_google_font_name;
} else if ( ! empty( $header_typography['font-family'] ) ) {
$header_font = $header_typography['font-family'];
}
// Don't do anything if the font-family is empty.
if ( ! empty( $header_typography['font-family'] ) || ! empty( $header_google_font_name ) ) :
?>
<style>
/* Header Typography */
h1, h2, h3, h4, h5, h6 {
font-family: "<?php echo $header_font; ?>", 'Helvetica Neue', Helvetica, sans-serif;
}
</style>
<?php
endif;
}
add_action( 'wp_head', 'mega_print_header_typography' );
/**
* Add a style block to the theme for the primary link color.
*/
function mega_print_primary_link_color_style() {
$primary_link_color = ot_get_option( 'primary_link_color' );
// Don't do anything if the primary link color is empty or the default.
if ( empty( $primary_link_color ) || $primary_link_color == '#14b6ea' )
return;
?>
<style>
/* Primary Link color */
a,
.person-desc a,
.title-visible .portfolio-data:focus,
.title-visible .portfolio-data:active,
.title-visible .portfolio-data:hover,
.more-link,
.rsTitle a:focus,
.rsTitle a:active,
.rsTitle a:hover {
color: <?php echo $primary_link_color; ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'mega_print_primary_link_color_style' );
/**
* Add a style block to the theme for the navigation link color.
*/
function mega_print_navigation_link_color_style() {
$navigation_link_color = ot_get_option( 'navigation_link_color' );
// Don't do anything if the navigation link color is empty or the default.
if ( empty( $navigation_link_color ) || $navigation_link_color == '#111111' )
return;
$rgb_navigation_link_color = hex2rgb( $navigation_link_color );
$opacity = .25;
$rgba_navigation_link_color = "rgba(" . $rgb_navigation_link_color[0] . ", " . $rgb_navigation_link_color[1] . ", " . $rgb_navigation_link_color[2] . ", " . $opacity . ")";
?>
<style>
/* Navigation Link color */
#access ul li a:hover,
#access ul li.sfHover > a,
#access ul .current-menu-item > a,
#access ul .current_page_item > a {
color: <?php echo $navigation_link_color; ?>;
border-color: <?php echo $rgba_navigation_link_color; ?>;
}
#access ul li li a:hover,
#access ul .menu-item-object-custom.current-menu-item a:hover {
color: <?php echo $navigation_link_color; ?>;
}
.ui-tabs .ui-tabs-nav .ui-tabs-active {
border-color: <?php echo $navigation_link_color; ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'mega_print_navigation_link_color_style' );
/**
* Adds background image.
*/
function mega_print_background_style() {
$background = ot_get_option( 'background', array() );
?>
<style>
/* Background */
body,
#secondary {
<?php if ( ! empty( $background['background-color'] ) ) { ?>
background-color: <?php echo $background['background-color']; ?>;
<?php } ?>
<?php if ( ! empty( $background['background-image'] ) ) { ?>
background-image: url('<?php echo $background['background-image']; ?>');
<?php } ?>
<?php if ( ! empty( $background['background-repeat'] ) ) { ?>
background-repeat: <?php echo $background['background-repeat']; ?>;
<?php } ?>
<?php if ( ! empty( $background['background-attachment'] ) ) { ?>
background-attachment: <?php echo $background['background-attachment']; ?>;
<?php } ?>
<?php if ( ! empty( $background['background-position'] ) ) { ?>
background-position: <?php echo $background['background-position']; ?>;
<?php } ?>
}
</style>
<?php
}
add_action( 'wp_head', 'mega_print_background_style' );
/**
* Adds background image to navigation.
*/
function mega_print_background_navigation_style() {
$background_navigation = ot_get_option( 'background_navigation', array() );
?>
<style>
/* Background for Navigation */
#header-wrapper {
<?php if ( ! empty( $background_navigation['background-color'] ) ) { ?>
background-color: <?php echo $background_navigation['background-color']; ?>;
<?php } ?>
<?php if ( ! empty( $background_navigation['background-image'] ) ) { ?>
background-image: url('<?php echo $background_navigation['background-image']; ?>');
<?php } ?>
<?php if ( ! empty( $background_navigation['background-repeat'] ) ) { ?>
background-repeat: <?php echo $background_navigation['background-repeat']; ?>;
<?php } ?>
<?php if ( ! empty( $background_navigation['background-attachment'] ) ) { ?>
background-attachment: <?php echo $background_navigation['background-attachment']; ?>;
<?php } ?>
<?php if ( ! empty( $background_navigation['background-position'] ) ) { ?>
background-position: <?php echo $background_navigation['background-position']; ?>;
<?php } ?>
}
</style>
<?php
}
add_action( 'wp_head', 'mega_print_background_navigation_style' );