secret
Last active

The Events Calendar: Conditional Page Titles

  • Download Gist
conditional-page-titles.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<div id="pageHead">
 
<?php if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page ?>
<h1 class="home">The Main Calendar</h1>
<?php } elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages ?>
<h1 class="home">Calendar Category: <?php echo tribe_meta_event_category_name(); ?></h1>
<?php } elseif( tribe_is_event() && !tribe_is_day() && !is_single() && !is_tax() ) { // The Main Events List ?>
<h1 class="home">Events List</h1>
<?php } elseif( tribe_is_event() && !tribe_is_day() && !is_single() && is_tax() ) { // Category Events List ?>
<h1 class="home">Events List: <?php echo tribe_meta_event_category_name(); ?></h1>
<?php } elseif( tribe_is_event() && is_single() ) { // Single Events ?>
<h1><?php the_title(); ?></h1>
<?php } elseif( tribe_is_day() ) { // Single Event Days ?>
<h1><?php $title = 'Events on: ' . date('F j, Y', strtotime(get_query_var( 'eventDate' ))); ?></h1>
<?php } elseif( tribe_is_venue() ) { // Single Venues ?>
<h1><?php the_title(); ?></h1>
<?php } else { ?>
<h1><?php the_title(); ?></h1>
<?php } ?>
<?php $page_description = get_post_meta($post->ID, "_ttrust_page_description_value", true); ?>
<?php if ($page_description) : ?>
<p><?php echo $page_description; ?></p>
<?php endif; ?>
</div><!--end pageHead -->

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.