Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

The Events Calendar Plugin takes on title of first event WordPress

  • SOLVED

Hi,
I'm using Avada theme and plugin 'The Events Calendar'. The calendar page title shows the title of the first event. The title is also repeated on the single event. I want to remove this title completely, without affecting the other titles on the website. I found some instructions but it makes no difference. Code was as follows:


<?php
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' . ' &raquo; ' . 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;
}
}
?>


You can see the problem page at:
http://www.2014.digitalschools.ie/events/

You need access (I'm not worried about showing login details as it's just to hide from public!)
User Name: dsd2014
Pass: comebacksunnydays14
I'm not good on php - maybe the code needs some tweaking?
Thanks.

Answers (4)

2014-08-27

timDesain Nanang answers:

Page title after the header is part of the avada theme.

Your hook <strong>will not affect</strong> the page title.

1. copy <strong>header.php</strong> file from /wp-content/themes/Avada/ to /wp-content/themes/Avada-Child-Theme/
2. modifiy page title in the header.php file

would you like to share the header.php code here or on http://pastebin.com?


Ailsa Craig comments:

Hi,
Thanks, I've put the header.php up in pastebin
http://pastebin.com/qXA1JY3Y

I see the <title> at top of header.php - maybe this is what I should be editing?


<title>
<?php
if ( defined('WPSEO_VERSION') ) {
wp_title('');
} else {
bloginfo('name'); ?> <?php wp_title(' - ', true, 'left');
}
?>
</title>


timDesain Nanang comments:

Hi Ailsa,
<title> tag is for title bar, not for page title.

You can try this:
1. copy header.php file from /wp-content/themes/Avada/ to /wp-content/themes/Avada-Child-Theme/
2. open header.php of the child theme (http://pastebin.com/qXA1JY3Y)
3. go to line 778, then change this part:
avada_current_page_title_bar( $c_pageID );
with:

if( tribe_is_event() OR tribe_is_month() OR tribe_is_day()){
?>
<div class="page-title-container">
<div class="page-title">
<div class="page-title-wrapper">
<div class="page-title-captions">
<h1 class="entry-title">
<?php
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' . ' &raquo; ' . 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;
}
?>
</h1>
</div>
</div>
</div>
</div> <?php
} else{
avada_current_page_title_bar( $c_pageID );
}




timDesain Nanang comments:

I am sorry,
I mean this code (return replaced with echo)

if( tribe_is_event() OR tribe_is_month() OR tribe_is_day()){
?>
<div class="page-title-container">
<div class="page-title">
<div class="page-title-wrapper">
<div class="page-title-captions">
<h1 class="entry-title">
<?php
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 'Event Title: '. $title;
} else {
echo $title;
}
?>
</h1>
</div>
</div>
</div>
</div> <?php
} else{
avada_current_page_title_bar( $c_pageID );
}