Skip to content

Instantly share code, notes, and snippets.

@stovak
Created April 8, 2016 18:51
Show Gist options
  • Save stovak/28f128de991a59fa6ebf83701baa2ecb to your computer and use it in GitHub Desktop.
Save stovak/28f128de991a59fa6ebf83701baa2ecb to your computer and use it in GitHub Desktop.
function mantra_title_and_description() {
$mantra_options = mantra_get_theme_options();
foreach ($mantra_options as $key => $value) { ${"$key"} = $value; }
// 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 ) && ($mantra_fheader == "Enable") && ($image = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'header' ) ) && ($image[1] >= HEADER_IMAGE_WIDTH) ):
$himgsrc = $image[0];
endif;
if (isset($himgsrc) && ($himgsrc != '')) : echo '<img id="bg_image" alt="" title="" src="'.$himgsrc.'" />'; endif;
?>
<div id="header-container">
<?php
switch ($mantra_siteheader) {
case 'Site Title and Description':
echo '<div>';
$heading_tag = ( ( is_home() || is_front_page() ) && !is_page() ) ? 'h1' : 'div';
echo '<'.$heading_tag.' id="site-title">';
echo '<span> <a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'" rel="home">'.get_bloginfo( 'name' ).'</a> </span>';
echo '</'.$heading_tag.'>';
echo '<div id="site-description" >'.get_bloginfo( 'description' ).'</div></div>';
break;
case 'Clickable header image' :
echo '<a href="'.esc_url( home_url( '/' ) ).'" id="linky"></a>' ;
break;
case 'Custom Logo' :
if (isset($mantra_logoupload) && ($mantra_logoupload != '')) : echo '<div><a id="logo" href="'.esc_url( home_url( '/' ) ).'" ><img title="" alt="" src="'.$mantra_logoupload.'" /></a></div>'; endif;
break;
case 'Empty' :
// nothing to do here
break;
}
if ($mantra_socialsdisplay0): mantra_header_socials(); endif;
echo '</div>';
} // mantra_title_and_description()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment