The Calendar Page Title shows the title of an event. How can I fix it?

If the page title has take on the title of the first event, there are a couple of things you can do to fix this.

First, find out what you are using for your Events Template in Events > Settings > Template. Make note of the setting here. If you’ve got the “Default Events Template” option selected, then add the following code to your themes functions.php file and modify as needed to set the titles you want:

add_filter('tribe_get_events_title', 'my_get_events_title');
function my_get_events_title($title) {
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
	return 'Events Calendar';
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
	return 'Events Calendar' . ' » ' . single_term_title('', false);
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
	return 'Events List';
} elseif( tribe_is_event() && is_single() ) { // Single Events
	return get_the_title();
} elseif( tribe_is_day() ) { // Single Event Days
	return 'Events on: ' . date('F j, Y', strtotime($wp_query->query_vars['eventDate']));
} elseif( tribe_is_venue() ) { // Single Venues
	return $title;
} else {
	return $title;
}
}

If you’ve got the Default Page Template selected, then first try opening up your theme’s page.php file and look for where the_title() is executed. If you don’t see the_title() in page.php, try looking in header.php. It helps to do a find in the file instead of scanning it but I’ll leave that up to you. If you don’t find the_title() in either of those files then it’s either in another template or added dynamically some other way in your theme and you’ll need to track it down. Try looking in your theme’s documentation and look up where the_title() is executed. You may need to contact the theme author.

As an example, in your theme you might find:

<?php the_title(); ?>

or:

<?php echo get_the_title(); ?>

Once you’ve found where the_title() is executed, you’ll want to use these conditional wrappers: https://gist.github.com/2415009 – to help you conditionally set the title for any of the event related pages (look at the comments in the wrapper code). Basically you’re going to want to hard code the title for the calendar (gridview) page similar to the following:

if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
	echo 'Events Calendar';
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
	echo 'Events Calendar' . ' &raquo; ' . single_term_title('', false);
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
	echo 'Events List';
} elseif( tribe_is_event() && is_single() ) { // Single Events
	echo get_the_title();
} elseif( tribe_is_day() ) { // Single Event Days
	echo 'Events on: ' . date('F j, Y', strtotime($wp_query->query_vars['eventDate']));
} elseif( tribe_is_venue() ) { // Single Venues
	echo get_the_title();
} else {
	echo get_the_title();
}

Pay attention to any specific code your theme may be using for the title too because you may want to wrap items in HTML and the like. Here is another example from a specific theme where the_title() would be wrapped in HTML markup:

<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 -->

I hope that helps! If you have any questions about this or need theme specific help, please open up a thread in our forum: http://tri.be/support/forums/

Posted in: Troubleshooting

Modern Tribe Newsletter

Insight, Discounts & Notices for People Who Kick Ass..