/**
* These are convenience functions
*/
function gs_remove_entry_title()
{
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
}
function gs_entry_title( $func ) {
add_action( 'genesis_after_header', $func );
}
gs_entry_title( 'gs_do_entry_title' );
function gs_do_entry_title()
{
/*
* We do not want to modify the home or front page title,
*/
if ( is_home() || is_front_page() ) {
return;
}
/**
* Default use the normal title
*/
$title = get_the_title();
$class = 'entry-title';
/**
* Let's see if there is a custom field type to tell us
* what entry title to use..
*/
/*
* If this is a single post or a page we want to take the
* title of the post / page for our banner.
*
* If we are viewing a category or archive of some type, we
* want to take the title from that archive.
*
* I really need to create a unique 404 page.
*/
if ( is_single() || is_page() ) {
gs_remove_entry_title();
$title = get_the_title();
$class .= ' single';
} else if ( is_author() ) {
$title = get_the_author();
$class .= ' author';
} else if ( is_category() || is_archive() ) {
$class .= ' archive';
$cats = get_the_category();
$cat = $cats[0];
$title = $cat->name;
} else if ( is_404() ) {
$title = "Ooops! I don't know what your looking for...";
$class .= ' c404';
}
?>
<!-- Header banner on the main page -->
<header class='<?php echo $class ?>'>
<h1><?php echo $title; ?></h1>
</header>
<?php
}
@mixin title-darkener($start-color:#f7f7f7, $howmuch:15%) {
$end-color: darken( $start-color, $howmuch );
@include radial-gradient( $start-color, $end-color );
border-bottom: 1px solid darken( $start-color, $howmuch / 2 );
}
@mixin title-background($start-color:#f7f7f7, $end-color:#d2d2d2) {
@include radial-gradient( $start-color, $end-color );
border-bottom: 1px solid darken( $end-color, 80% );
}
/**
* Move the entry title just under the navbar and give it a
* cool background color to set it apart.
*/
$banner-background-default: #f7f7f7;
$banner-background-404: #F76C37;
header.entry-title {
padding: 30px 0;
@include title-darkener( $banner-background-default );
&.c404 {
background: $banner-background-404;
@include title-background( #FFC051, $banner-background-404 );
}
h1 {
@include wrap;
color: black;
margin-bottom: 0;
text-align: center;
}
}