Skip to content

Instantly share code, notes, and snippets.

@billrobbins
Created October 27, 2014 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billrobbins/81c3586a6b0da66529a9 to your computer and use it in GitHub Desktop.
Save billrobbins/81c3586a6b0da66529a9 to your computer and use it in GitHub Desktop.
<?php if ( is_page() && has_post_thumbnail() ) { ?>
<div id="hero-section" class="<?php echo get_post_meta($post->ID, "hero_height", TRUE); ?>">
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
<style>
#hero-section { background-image: url(<?php echo $image[0]; ?>) }
<?php if ( get_post_meta( $post->ID, "hero_title_color", $single = true ) != "" ){ ?>
.hero-copy h2.hero-title,
.hero-copy p {
color: <?php echo get_post_meta($post->ID, "hero_title_color", TRUE); ?>;
}
.hero-title {
border-color: <?php echo get_post_meta($post->ID, "hero_title_color", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_button_text_color", $single = true ) != "" ) { ?>
.hero-copy a.button.hero {
color: <?php echo get_post_meta($post->ID, "hero_button_text_color", TRUE); ?>;
border-color: <?php echo get_post_meta($post->ID, "hero_button_text_color", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_button_text_hover", $single = true ) != "" ) { ?>
.hero-copy a.button.hero:hover {
color: <?php echo get_post_meta($post->ID, "hero_button_text_hover", TRUE); ?>;
border-color: <?php echo get_post_meta($post->ID, "hero_button_text_hover", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_navigation_color", $single = true ) != "" ) { ?>
nav#top-menu li a,
nav#top-menu li a:visited {
color: <?php echo get_post_meta($post->ID, "hero_navigation_color", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_navigation_color_hover", $single = true ) != "" ) { ?>
nav#top-menu li.current-menu-item a,
nav#top-menu li a:hover {
color: <?php echo get_post_meta($post->ID, "hero_navigation_color_hover", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_navigation_drop_background", $single = true ) != "" ) { ?>
nav#top-menu ul li:hover ul {
background-color: <?php echo get_post_meta($post->ID, "hero_navigation_drop_background", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_navigation_drop_item", $single = true ) != "" ) { ?>
#header nav#top-menu ul ul li a,
#header nav#top-menu ul ul li a:visited,
#header nav#top-menu ul ul ul li a,
#header nav#top-menu ul ul ul li a:visited,
#header nav#top-menu ul li.current-menu-item ul li a,
#header nav#top-menu ul li.current-menu-item ul li a:visited {
color: <?php echo get_post_meta($post->ID, "hero_navigation_drop_item", TRUE); ?>;
}
<?php } ?>
<?php if ( get_post_meta($post->ID, "hero_navigation_drop_item_hover", $single = true ) != "" ) { ?>
#header nav#top-menu ul ul li a:hover,
#header nav#top-menu ul li ul li.current-menu-item a,
#header nav#top-menu ul li.current-menu-item a:hover {
color: <?php echo get_post_meta($post->ID, "hero_navigation_drop_item_hover", TRUE); ?>;
}
<?php } ?>
</style>
<div class="hero-copy <?php echo get_post_meta($post->ID, "hero_alignment", TRUE); ?>">
<?php if(get_post_meta($post->ID, "hero_title", $single = true) != ""){ ?>
<div class="hero-title-holder">
<h2 class="hero-title"><?php echo get_post_meta($post->ID, "hero_title", TRUE); ?></h2>
</div>
<?php } ?>
<?php if(get_post_meta($post->ID, "hero_caption", $single = true) != ""){ ?>
<div class="hero-caption">
<p><?php echo get_post_meta($post->ID, "hero_caption", TRUE); ?></p>
</div>
<?php } ?>
<?php if(get_post_meta($post->ID, "hero_button_text", $single = true) != ""){ ?>
<div class="hero-button-holder">
<a class="button hero" href="<?php echo get_post_meta($post->ID, "hero_button_url", TRUE); ?>"><?php echo get_post_meta($post->ID, "hero_button_text", TRUE); ?></a>
</div>
<?php } ?>
</div>
</div><!-- #hero-section -->
<?php } else if ( is_category() ) { ?>
<div id="hero-section" class="full-height">
<style>
#hero-section { background-image: url(<?php if (series_taxonomy_image_url() != "") {
$image_url = series_taxonomy_image_url();
// store the image ID in a var
$image_id = organizedthemes_series_image_id($image_url);
// retrieve the thumbnail size of our image
$image_thumb = wp_get_attachment_image_src($image_id, 'single');
// display the image
echo $image_thumb[0] ;
} ?>) }
</style>
<div class="hero-copy center-text">
<div class="hero-title-holder">
<h2 class="hero-title"><?php single_cat_title(); ?></h2>
</div>
<div class="hero-caption">
<p><?php echo term_description( '', get_query_var( 'taxonomy' ) ); ?></p>
</div>
</div>
</div><!-- #hero-section -->
<?php } else if ( is_home() ) { ?>
<div id="hero-section" class="full-height">
<style>
#hero-section { background-image: url(http://yoursite.com/image.jpg) }
</style>
<div class="hero-copy center-text">
<div class="hero-title-holder">
<h2 class="hero-title">Hero Title</h2>
</div>
<div class="hero-caption">
<p>Hero Caption</p>
</div>
<div class="hero-button-holder">
<a class="button hero" href="http://yourlink.com">Button Text</a>
</div>
</div>
</div><!-- #hero-section -->
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment