Created
June 29, 2020 11:39
-
-
Save hansschuijff/f4f9d24bafe93b4e1acd9d698203e7e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Relocates page titles and adds header image wrapper. | |
* | |
* @since 1.0.0 | |
*/ | |
function essence_page_hero_header() { | |
add_action( 'genesis_before_header', 'essence_header_hero_start' ); | |
add_action( 'genesis_after_header', 'essence_header_title_wrap', 90 ); | |
add_action( 'genesis_after_header', 'essence_header_title_end_wrap', 98 ); | |
add_action( 'genesis_after_header', 'essence_header_hero_end', 99 ); | |
if ( is_single() || is_page() && ! genesis_is_blog_template() && ! genesis_get_custom_field( 'query_args' ) ) { | |
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); | |
remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); | |
// begin tvu changed (added priorities only) | |
add_action( 'essence_entry_header', 'genesis_entry_header_markup_open', 5 ); | |
add_action( 'essence_entry_header', 'genesis_do_post_title' ); | |
add_action( 'essence_entry_header', 'genesis_post_info', 12 ); | |
add_action( 'essence_entry_header', 'genesis_entry_header_markup_close', 15 ); | |
// end tvu changed (added priorities only) | |
// begin tvu added | |
add_action( 'essence_entry_header', 'tvu_do_event_archive_title' ); | |
// end tvu added | |
} elseif ( is_home() || is_tag() || is_category() || is_archive() || genesis_is_blog_template() ) { | |
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); | |
remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 ); | |
remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 ); | |
remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' ); | |
remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' ); | |
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' ); | |
remove_action( 'genesis_before_loop', 'genesis_do_blog_template_heading' ); | |
add_action( 'essence_entry_header', 'genesis_do_blog_template_heading' ); | |
add_action( 'essence_entry_header', 'genesis_do_taxonomy_title_description' ); | |
add_action( 'essence_entry_header', 'genesis_do_author_title_description' ); | |
add_action( 'essence_entry_header', 'genesis_do_author_box_archive' ); | |
add_action( 'essence_entry_header', 'genesis_do_cpt_archive_title_description' ); | |
add_action( 'essence_entry_header', 'genesis_do_date_archive_title' ); | |
add_action( 'essence_entry_header', 'genesis_do_posts_page_heading' ); | |
// begin tvu added | |
add_action( 'essence_entry_header', 'tvu_do_event_archive_title' ); | |
// end tvu added | |
} elseif ( is_search() ) { | |
remove_action( 'genesis_before_loop', 'genesis_do_search_title' ); | |
add_action( 'essence_entry_header', 'genesis_do_search_title' ); | |
} | |
} | |
/** | |
* Generate page title on Event pages | |
* | |
* @return void | |
*/ | |
function tvu_do_event_archive_title(){ | |
global $wp_query; | |
if ( class_exists( 'Tribe__Events__Main' ) ) | |
{ | |
if ( is_singular( 'tribe_events' ) ) | |
{ | |
?> | |
<h1 class="entry-title"> | |
<?php echo $wp_query->queried_object->post_title; ?> | |
</h1> | |
<?php do_action( 'tribe_events_after_the_title' ); | |
return; | |
} | |
if ( tribe_is_past() || ( tribe_is_upcoming() && is_tax() ) ) | |
{ | |
return; | |
} | |
} | |
if ( class_exists( 'Tribe__Events__Main' ) | |
&& class_exists( 'Tribe__Events__Pro__Main' ) ) { | |
// when pro is installed, check for all standard views | |
if ( tribe_is_month() // month view | |
|| tribe_is_upcoming() // list view | |
|| tribe_is_past() // past events view | |
|| tribe_is_day() // day view | |
|| tribe_is_map() // map view | |
|| tribe_is_photo() // photo view | |
|| tribe_is_week() // week view | |
|| ( tribe_is_recurring_event() | |
&& ! is_singular( 'tribe_events' ) ) | |
) | |
{ | |
?> | |
<div class="tribe-events-title-bar"> | |
<?php do_action( 'tribe_events_before_the_title' ); ?> | |
<h1 class="tribe-events-page-title"><?php echo tribe_get_events_title() ?></h1> | |
<?php do_action( 'tribe_events_after_the_title' ); ?> | |
</div> | |
<?php | |
} | |
} elseif ( class_exists( 'Tribe__Events__Main' ) | |
&& ! class_exists( 'Tribe__Events__Pro__Main' ) ) { | |
// when pro is installed, check for non-pro views only | |
if ( tribe_is_month() // month view | |
|| tribe_is_upcoming() // list view | |
|| tribe_is_past() // past events view | |
|| tribe_is_day() // day view | |
) | |
{ | |
?> | |
<div class="tribe-events-title-bar"> | |
<?php do_action( 'tribe_events_before_the_title' ); ?> | |
<h1 class="tribe-events-page-title"><?php echo tribe_get_events_title() ?></h1> | |
<?php do_action( 'tribe_events_after_the_title' ); ?> | |
</div> | |
<?php | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment