|
/** |
|
* 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 |
|
} |
|
|
|
|
Hmm, why can't I save the file type on the .scss file and the tabs = 4 spaces on both files?