$value) { ${"$key"} = $value ; } global $nirvana_totalSize; // Header styling and image loading // Check if this is a post or page, if it has a thumbnail, and if it's a big one global $post; if ( get_header_image() != '' ) { $himgsrc = get_header_image(); } if ( is_singular() && has_post_thumbnail( $post->ID ) && $nirvana_fheader == "Enable" && ( ($nirvana_duality=='Boxed')? $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'header' ) : $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ) ) && $image[1] >= $nirvana_totalSize ) : $himgsrc= $image[0]; endif; if (isset($himgsrc) && ($himgsrc != '')) : echo ''; endif; } add_action ('cryout_branding_hook','nirvana_header_image'); function nirvana_title_and_description() { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } ?>
'; $heading_tag = ( ( is_home() || is_front_page() ) && !is_page() ) ? 'h1' : 'div'; echo '<'.$heading_tag.' id="site-title">'; echo ' ' . get_bloginfo( 'name' ) . ' '; echo ''; echo '
' . get_bloginfo( 'description' ) . '
'; break; case 'Clickable header image' : echo '' ; break; case 'Custom Logo' : if (isset($nirvana_logoupload) && ($nirvana_logoupload != '')) : echo '
'; endif; break; case 'Empty' : break; } ?>'; nirvana_set_social_icons('sfooter'); echo ''; } function nirvana_slefts_socials() { nirvana_set_social_icons('slefts'); } function nirvana_srights_socials() { nirvana_set_social_icons('srights'); } //Adding socials to the topbar if($nirvana_socialsdisplay0) add_action('cryout_topbar_hook', 'nirvana_header_socials',13); // Adding socials to the footer if($nirvana_socialsdisplay3) add_action('cryout_footer_hook', 'nirvana_footer_socials',17); // Adding socials to the left and right browser sides if($nirvana_socialsdisplay4) add_action('cryout_wrapper_hook', 'nirvana_slefts_socials',13); if($nirvana_socialsdisplay5) add_action('cryout_wrapper_hook', 'nirvana_srights_socials',13); if ( ! function_exists( 'nirvana_set_social_icons' ) ) : /** * Social icons function */ function nirvana_set_social_icons($idd) { $cryout_special_keys = array('Mail', 'Skype'); global $nirvanas; foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } echo '
'; for ($i=1; $i<=9; $i+=2) { $j=$i+1; if ( ${"nirvana_social$j"} ) { if (in_array(${"nirvana_social$i"},$cryout_special_keys)) : $cryout_current_social = esc_html( ${"nirvana_social$j"} ); else : $cryout_current_social = esc_url( ${"nirvana_social$j"} ); endif; ?> href="" class="socialicons social-" title=""> <?php echo esc_attr(${" src="" /> '; } // nirvana_set_social_icons() endif; /** * Nirvana back to top button * Creates div for js */ function nirvana_back_top() { echo '
'; } // nirvana_back_top() if ($nirvana_backtop=="Enable") add_action ('cryout_main_hook','nirvana_back_top'); /** * Creates breadcrumns with page sublevels and category sublevels. */ function nirvana_breadcrumbs() { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } $showOnHome = 1; // 1 - show breadcrumbs on the homepage, 0 - don't show $separator = ''; // separator between crumbs $home = '' . __('Home', 'nirvana') . ''; // text for the 'Home' link $showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb global $post; $homeLink = esc_url( home_url() ); if (is_front_page() && $nirvana_frontpage=="Enable") { return; } if (is_home() && $nirvana_frontpage!="Enable") { if ($showOnHome == 1) echo ''; } else { echo ''; } }// breadcrumbs if($nirvana_breadcrumbs=="Enable") add_action ('cryout_breadcrumbs_hook','nirvana_breadcrumbs'); if ( !empty($nirvana_searchbar['top']) ) add_filter('wp_nav_menu_items','cryout_search_topmenu', 10, 2); if ( !empty($nirvana_searchbar['main']) ) add_filter('wp_nav_menu_items','cryout_search_primarymenu', 10, 2); if ( !empty($nirvana_searchbar['footer']) ) add_filter('wp_nav_menu_items','cryout_search_footermenu', 10, 2); function cryout_search_topmenu( $items, $args ) { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } if( $args->theme_location == 'top') { $items = $items.""; } return $items; } function cryout_search_primarymenu( $items, $args ) { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } if( $args->theme_location == 'primary') { $items = $items . ""; } return $items; } function cryout_search_footermenu( $items, $args ) { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } if( $args->theme_location == 'footer') { $items = $items.""; } return $items; } if ( ! function_exists( 'nirvana_pagination' ) ) : /** * Creates pagination for blog pages. */ function nirvana_pagination($pages = '', $range = 2, $prefix ='') { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "
\n"; } } // nirvana_pagination() endif; function nirvana_nextpage_links($defaults) { $args = array( 'link_before' => '', 'link_after' => '', ); $r = wp_parse_args($args, $defaults); return $r; } add_filter('wp_link_pages_args','nirvana_nextpage_links'); /** * Site info */ function nirvana_site_info() { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } ?> & $value) { ${"$key"} = $value ; } echo ''; } // nirvana_copyright() if ( !empty($nirvana_copyright) ) add_action('cryout_footer_hook','nirvana_copyright',11); if ( ! function_exists( 'nirvana_get_sidebar' ) ) : function nirvana_get_sidebar() { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } switch($nirvana_side) { case '2cSl': get_sidebar('left'); break; case '2cSr': get_sidebar('right'); break; case '3cSl' : case '3cSr' : case '3cSs' : get_sidebar('left'); get_sidebar('right'); break; default: break; } } // nirvana_get_sidebar() endif; if ( ! function_exists( 'nirvana_get_layout_class' ) ) : function nirvana_get_layout_class() { $nirvanas = nirvana_get_theme_options(); foreach ($nirvanas as $key => $value) { ${"$key"} = $value ; } switch($nirvana_side) { case '2cSl': return "two-columns-left"; break; case '2cSr': return "two-columns-right"; break; case '3cSl': return "three-columns-left"; break; case '3cSr' : return "three-columns-right"; break; case '3cSs' : return "three-columns-sided"; break; case '1c': default: return "one-column"; break; } } // nirvana_get_layout_class() endif; /** * Retrieves the IDs for images in a gallery. * @since nirvana 0.9 * @return array List of image IDs from the post gallery. */ function nirvana_get_gallery_images() { $images = array(); if ( function_exists( 'get_post_galleries' ) ) { $galleries = get_post_galleries( get_the_ID(), false ); if ( isset( $galleries[0]['ids'] ) ) $images = explode( ',', $galleries[0]['ids'] ); } else { $pattern = get_shortcode_regex(); preg_match( "/$pattern/s", get_the_content(), $match ); $atts = shortcode_parse_atts( $match[3] ); if ( isset( $atts['ids'] ) ) $images = explode( ',', $atts['ids'] ); } if ( ! $images ) { $images = get_posts( array( 'fields' => 'ids', 'numberposts' => 999, 'order' => 'ASC', 'orderby' => 'none', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_type' => 'attachment', ) ); } return $images; } // nirvana_get_gallery_images() /** * Checks the browser agent string for mobile ids and adds "mobile" class to body if true * @return array list of classes. */ function nirvana_mobile_body_class($classes){ $nirvanas = nirvana_get_theme_options(); if ($nirvanas['nirvana_mobile']=="Enable"): $browser = (isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:''); $keys = 'mobile|android|mobi|tablet|ipad|opera mini|series 60|s60|blackberry'; if (preg_match("/($keys)/i",$browser)): $classes[] = 'mobile'; endif; // mobile browser detected endif; return $classes; } add_filter('body_class', 'nirvana_mobile_body_class'); ////////// HELPER FUNCTIONS ////////// function cryout_optset($var,$val1,$val2='',$val3='',$val4=''){ $vals = array($val1,$val2,$val3,$val4); if (in_array($var,$vals)): return false; else: return true; endif; } // cryout_optset() function cryout_fontname_cleanup( $fontid ) { // do not process non font ids if ( strtolower(trim($fontid)) == 'general font' ) return $fontid; $fontid = trim($fontid); $fonts = @explode(",", $fontid); // split multifont ids into fonts array if (is_array($fonts)){ foreach ($fonts as &$font) { $font = trim($font); // if font has space in name, quote it if (strpos($font,' ')>-1) $font = '"' . $font . '"'; }; return implode(', ',$fonts); } elseif (strpos($fontid,' ')>-1) { // if font has space in name, quote it return '"' . $fontid . '"'; } else return $fontid; } // cryout_fontname_cleanup function cryout_hex2rgb($hex) { $hex = str_replace("#", "", $hex); if (preg_match("/^([a-f0-9]{3}|[a-f0-9]{6})$/i",$hex)): if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } $rgb = array($r, $g, $b); return implode(",", $rgb); // returns the rgb values separated by commas else: return ""; // input string is not a valid hex color code endif; } // cryout_hex2rgb() function cryout_hexadder($hex,$inc) { $hex = str_replace("#", "", $hex); if (preg_match("/^([a-f0-9]{3}|[a-f0-9]{6})$/i",$hex)): if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } $rgb_array = array($r,$g,$b); $newhex="#"; foreach ($rgb_array as $el) { $el+=$inc; if ($el<=0) { $el='00'; } elseif ($el>=255) {$el='ff';} else {$el=dechex($el);} if(strlen($el)==1) {$el='0'.$el;} $newhex.=$el; } return $newhex; else: return ""; // input string is not a valid hex color code endif; } // cryout_hexadder() function cryout_gfontclean( $gfont, $mode = 1 ) { switch ($mode) { case 2: // for custom styling return esc_attr(str_replace('+',' ',preg_replace('/[:&].*/','',$gfont))); break; case 1: // for font enqueuing default: return esc_attr(preg_replace( '/\s+/', '+',$gfont)); break; } // switch } // cryout_gfontcleanup() ?>